[fix] Re-order dispatchers so that /s?q_\d* commands work

This commit is contained in:
Ceda EI 2021-04-24 12:43:22 +05:30
parent 1f0a05ca9d
commit 6116594eb4
1 changed files with 3 additions and 3 deletions

6
bot.py
View File

@ -631,7 +631,7 @@ with open('schema.sql') as f:
cursor.executescript(f.read()) cursor.executescript(f.read())
db.commit() db.commit()
updater = Updater(token=config.api_key) updater = Updater(token=config.api_key, use_context=False)
dispatcher = updater.dispatcher dispatcher = updater.dispatcher
dispatcher.add_handler(CommandHandler('start', start)) dispatcher.add_handler(CommandHandler('start', start))
@ -642,12 +642,12 @@ dispatcher.add_handler(CommandHandler('cancel', lambda x, y: me_handler(x, y,
db))) db)))
dispatcher.add_handler(CommandHandler('help', lambda x, y: help_command(x, y, dispatcher.add_handler(CommandHandler('help', lambda x, y: help_command(x, y,
db))) db)))
dispatcher.add_handler(MessageHandler(Filters.text, lambda x, y:
message_handling(x, y, db)))
dispatcher.add_handler(RegexHandler(r"/[Ss]?[Qq]_\d+", lambda x, y: dispatcher.add_handler(RegexHandler(r"/[Ss]?[Qq]_\d+", lambda x, y:
quest_handling(x, y, db))) quest_handling(x, y, db)))
dispatcher.add_handler(MessageHandler(Filters.command, lambda x, y: dispatcher.add_handler(MessageHandler(Filters.command, lambda x, y:
message_handling(x, y, db))) message_handling(x, y, db)))
dispatcher.add_handler(MessageHandler(Filters.text, lambda x, y:
message_handling(x, y, db)))
if config.update_method == "polling": if config.update_method == "polling":
updater.start_polling() updater.start_polling()