Replies: 4 comments 5 replies
-
This is the tutorial https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions---Your-first-Bot |
Beta Was this translation helpful? Give feedback.
-
Hi. Please have a look at https://github.com/python-telegram-bot/python-telegram-bot/wiki/Frequently-Asked-Questions#why-am-i-getting-importerror-cannot-import-name-xy-from-telegram. |
Beta Was this translation helpful? Give feedback.
-
all right, that means that the installation of
If that doesn't work, I would recommend to delete |
Beta Was this translation helpful? Give feedback.
-
So after I create this bot what can I do with it? https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions---Your-first-Bot |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Traceback (most recent call last):
File "/home/thomas/python/practice.py", line 2, in
from telegram import Update
ImportError: cannot import name 'Update' from 'telegram' (/home/thomas/python/my_test_environment/lib/python3.12/site-packages/telegram/init.py)
Following is my code:
import logging
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
await context.bot.send_message(chat_id=update.effective_chat.id, text="I'm a bot, please talk to me!")
if name == 'main':
application = ApplicationBuilder().token('TOKEN').build()
I am doing my first tutorial on my first bot
Beta Was this translation helpful? Give feedback.
All reactions