Answer the question
In order to leave comments, you need to log in
How to determine what is in the callback (aiogram)?
The bot generates buttons in the keyboard according to data from the database (names of people).
It is necessary to catch the user's choice (which button was clicked).
Now the callback is working, but I don't understand which button was pressed.
for item in list_button_name:
buttons_list.append([InlineKeyboardButton(text = item, callback_data = item)])
keyboard_inline_buttons = InlineKeyboardMarkup(inline_keyboard = buttons_list)
@dp.callback_query_handler(text = list_button_name)
async def process_callback_name(callback_query: types.CallbackQuery):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Вы выбрали имя ->' )
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question