Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Poolitzer
- if data.data == "cancel_login":
- welcome(update, context)
- update.effective_message.delete()
- del context.user_data['login']
- del context.user_data['password']
- return ConversationHandler.END
- this is in callback_handler
- @user_language
- def go_menu_timetable(update, context):
- print(context.user_data)
- update.effective_message.reply_markdown(_("msg_credentials_login"), reply_markup=inline_cancel_menu())
- return TYPING_LOGIN
- @user_language
- def get_auth_login(update, context):
- message_id = update.effective_message.message_id-1
- chat_id = update.effective_message.chat_id
- login = update.effective_message.text
- context.user_data['login'] = login
- context.bot.delete_message(chat_id=chat_id, message_id=message_id)
- update.effective_message.reply_markdown(text=_("msg_credentials_pass", params=[context.user_data['login']]), reply_markup=inline_cancel_menu())
- return TYPING_PASS
- @user_language
- def get_auth_pass(update, context):
- message_id = update.effective_message.message_id - 1
- chat_id = update.effective_message.chat_id
- context.user_data['password'] = update.effective_message.text
- context.bot.delete_message(chat_id=chat_id, message_id=message_id)
- text = _("msg_credentials_is_correct", params=[context.user_data['login'], context.user_data['password']])
- update.effective_message.reply_markdown(text, reply_markup=inline_cancel_menu())
- return ConversationHandler.END
- this is callbacks for conversationhandler
- auth_conv_handler = ConversationHandler(
- entry_points=[MessageHandler(Filters.regex(_("cmd_timetable", locale="all")), go_menu_timetable, pass_user_data=True)],
- states= {
- TYPING_LOGIN:[MessageHandler(Filters.text, get_auth_login, pass_user_data=True)],
- TYPING_PASS:[MessageHandler(Filters.text, get_auth_pass, pass_user_data=True)]
- },
- fallbacks=[CallbackQueryHandler(callback_handler)]
- )
- dp.add_handler(auth_conv_handler)
- this is conversation handler
Add Comment
Please, Sign In to add comment