Answer the question
In order to leave comments, you need to log in
How to use InlineKeyboard?
Hello everyone, I've run into a problem. I am using the TELEBOT library . This is how I create the keyboard:
def admin_keyboard(message):
...
keyboard = types.InlineKeyboardMarkup()
keyboard.add(
types.InlineKeyboardButton(text='Edit message', callback_data='edit_message_callback'),
types.InlineKeyboardButton(text='Foo', callback_data='foo_callback')
)
BOT.send_message(message.chat.id, "First message", reply_markup=keyboard)
@BOT.callback_query_handler(func=lambda call: True)
def callback_data_handler(call):
...
if call.data == 'edit_message_callback':
for some in some_list:
keyboard.add(
types.InlineKeyboardButton(text='Foo foo', callback_data='foo_foo_callback')
)
Answer the question
In order to leave comments, you need to log in
Figured out how to fix the problem. Let there be a callback, I process it with some function as follows:
Where call is the argument coming to the handler function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question