I'm trying to create a menu where the user can navigate on it. This is my code:
MENU, HELP = range(2)
def start(bot, update):
keyboard = [
[InlineKeyboardButton('Help', callback_data='help')]
]
# Create initial message:
message = 'Welcome.'
update.message.reply_text(message, reply_markup=InlineKeyboardMarkup(keyboard))
def help(bot, update):
keyboard = [
[InlineKeyboardButton('Leave', callback_data='cancel')]
]
update.callback_query.edit_message_reply_markup('Help ... help..', reply_markup=InlineKeyboardMarkup(keyboard))
def cancel(bot, update):
update.message.reply_text('Bye.', reply_markup=ReplyKeyboardRemove())
return ConversationHandler.END
# Create the EventHandler and pass it your bot's token.
updater = Updater(token=config.TELEGRAM_API_TOKEN)
# Get the dispatcher to register handlers:
dispatcher = updater.dispatcher
dispatcher.add_handler(CommandHandler('start', start))
dispatcher.add_handler(CallbackQueryHandler(help, pattern='help'))
dispatcher.add_handler(CallbackQueryHandler(cancel, pattern='cancel'))
updater.start_polling()
updater.idle()
As expected, at the /start the user gets the menu 'Help'. When the user clicks on it, the function help() is triggered as expected as well.
Based on my understanding of the python-telegram-bot documentation is was supposed to have the update.callback_query.inline_message_id populated, but its value is None.
I need the update.callback_query.inline_message_id to update my InlineKeyboard menu, right ? Why is the inline_message_id empty (None) ?
Python 3.6.7
python-telegram-bot==11.1.0
Best Regards. Kleyson Rios.