I'm using python-telegram-bot
to create a bot.
The bot waits for a message from the user after launch and does not work, when I click on the buttons of the message that the bot sent, it first needs to receive a message from the user
The buttons on the last message start working only when a user writes a message, that is, the past message will no longer make sense
def main() -> None: application = Application.builder().token(telegram_token).build()
conv_handler = ConversationHandler(
entry_points=[
MessageHandler(filters.COMMAND, main_menu),
MessageHandler(filters.TEXT, main_menu)],
states={
START_ROUTES: [
CallbackQueryHandler(main_menu_over, pattern="return_to_menu"),
CallbackQueryHandler(support_menu, pattern="support"),
],
END_ROUTES: [
CallbackQueryHandler(main_menu_over, pattern="return_to_menu"),
],
},
fallbacks=[
MessageHandler(filters.COMMAND, main_menu),
MessageHandler(filters.TEXT, main_menu)],
)
application.add_handler(conv_handler)
application.run_polling(allowed_updates=Update.ALL_TYPES)`
I thought there was some way to receive a callback query from a user after launching the bot, and not a message
I'm not quite sure what way to interpret your question, so I'm providing answers to possible interpretations:
MessageHandler
s. If you want the conversation to be started via a button, use a CallbackQueryHandler
(in addition or instead)Disclaimer: I'm currently the maintainer of python-telegram-bot
.