bug fix /addtoken
This commit is contained in:
parent
776f4f2c1f
commit
ab03728d00
1 changed files with 10 additions and 1 deletions
|
|
@ -296,6 +296,10 @@ class LichessBot:
|
||||||
|
|
||||||
async def addtoken_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
async def addtoken_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
"""Start addtoken command - token required"""
|
"""Start addtoken command - token required"""
|
||||||
|
# Reset any existing conversation state
|
||||||
|
if context and hasattr(context, "user_data"):
|
||||||
|
context.user_data.clear()
|
||||||
|
|
||||||
lang = self.get_user_language_from_update(update)
|
lang = self.get_user_language_from_update(update)
|
||||||
await update.message.reply_text(t('addtoken_prompt', lang))
|
await update.message.reply_text(t('addtoken_prompt', lang))
|
||||||
self.counters.increment('addtoken')
|
self.counters.increment('addtoken')
|
||||||
|
|
@ -1461,7 +1465,12 @@ class LichessBot:
|
||||||
states={
|
states={
|
||||||
WAITING_FOR_TOKEN: [MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_token)],
|
WAITING_FOR_TOKEN: [MessageHandler(filters.TEXT & ~filters.COMMAND, self.handle_token)],
|
||||||
},
|
},
|
||||||
fallbacks=[CommandHandler("cancel", lambda u, c: ConversationHandler.END)]
|
fallbacks=[
|
||||||
|
CommandHandler("cancel", lambda u, c: ConversationHandler.END),
|
||||||
|
CommandHandler("addtoken", self.addtoken_start) # Allow restarting conversation
|
||||||
|
],
|
||||||
|
per_chat=True,
|
||||||
|
per_user=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add handlers - ConversationHandler must be before general MessageHandler
|
# Add handlers - ConversationHandler must be before general MessageHandler
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue