Please help me fix this bug in my Python code.
Error type: Update tool.init() got an unexpected argument of the keyword 'token'
Code:
# Telegram Bot API
from telegram.text import Updater
updater = Updater(token='my bot token', context_user=True)
dispatcher = updater.dispatcher
I've tried different versions of the code, I can't figure out what the error is.
CodePudding user response:
telegram-bot==3.2.0 package it working fine and passing token as following
from telegram import Updater
updater = Updater(token='token')
CodePudding user response:
- The
Updater
class should be imported fromtelegram.ext
, nottext
- For older
python-bot-api
versions, remove thetoken=
part - Looking at the
Updater()
source code, there is no option calledcontext_user
, so remove that too
from telegram.ext import Updater
updater = Updater('my bot token')