I’m encountering an unexpected error while trying to start my Discord bot with the latest version 20 of the python-telegram-bot library. The error message implies that an update_queue argument is missing, but I’m not certain what has changed in the latest version.
Here’s the error message that keeps appearing:
Traceback (most recent call last):
File "/home/user/projects/chatbot/main.py", line 89, in <module>
run_bot()
File "/home/user/projects/chatbot/main.py", line 82, in run_bot
botUpdater = Updater("BOT-API-KEY")
TypeError: __init__() missing 1 required positional argument: 'update_queue'
My current code looks like this:
def run_bot():
# Setup database connection
database = sqlite3.connect('user_data.db')
cursor = database.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS messages (
user_id INTEGER,
content TEXT,
timestamp TIMESTAMP
)""")
cursor.execute("""CREATE TABLE IF NOT EXISTS blocked_users (
user_id INTEGER
)""")
database.commit()
database.close()
# List of admin user IDs
admin_list = [123456789, 987654321]
# Initialize bot updater and handlers
botUpdater = Updater("API_TOKEN", use_context=True)
dispatcher = botUpdater.dispatcher
dispatcher.add_handler(CommandHandler("help", show_help))
dispatcher.add_handler(CommandHandler("save", save_message))
dispatcher.add_handler(CommandHandler("block", block_user))
botUpdater.start_polling()
botUpdater.idle()
This code worked well in previous versions, but now it throws this error. What steps should I take to resolve this?