Import: cannot import name 'Bot' from 'Telegram'

Asked

Viewed 146 times

-2

I installed python-Telegram-bot version 13.0 and importing this error is happening. My libraries are up to date and the error continues. What am I doing wrong?

from telegram.ext import CommandHandler, MessageHandler, Filters, Updater

  File "ash.py", line 1, in <module>
    from telegram.ext import MessageHandler, CommandHandler, Filters, Updater
  File "/home/ChadLuiz/.local/lib/python3.8/site-packages/telegram/ext/__init__.py", line 21, in <module>
    from .basepersistence import BasePersistence
  File "/home/ChadLuiz/.local/lib/python3.8/site-packages/telegram/ext/basepersistence.py", line 25, in <module>
    from telegram import Bot
ImportError: cannot import name 'Bot' from 'telegram'

I updated Pip and reinstalled the libraries. I tried to install the library "Telegram.ext" and could not, but with only "Telegram" it installs. I’m missing the library?

1 answer

0

According to the documentação, follows the correct way to create a new instance of a bot:

import telegram
bot = telegram.Bot(token='TOKEN')

To generate a token you need to talk to @botfather

Browser other questions tagged

You are not signed in. Login or sign up in order to post.