Answer the question
In order to leave comments, you need to log in
How to change the Inline menu in a message to another Inline menu (aiogram)?
In general, I want to make it so that when I click on the `Inline` button, I get the next `Inline` menu in the same message.
I have this code:
#bot.py
@dp.message_handler(text=['Магазин'])
async def shop(message: types.Message):
await message.answer("Выберите подраздел: ", reply_markup=kb.inline_kb_full2)
inline_btn_3 = InlineKeyboardButton('A', callback_data='A')
inline_btn_4 = InlineKeyboardButton('B', callback_data='B')
inline_btn_5 = InlineKeyboardButton('C', callback_data='C')
inline_kb_full2 = InlineKeyboardMarkup(row_width=1).add(inline_btn_3,inline_btn_4,inline_btn_5)
inline_btn_6 = InlineKeyboardButton('1', switch_inline_query_current_chat='')
inline_btn_7 = InlineKeyboardButton('2', switch_inline_query_current_chat='')
inline_btn_8 = InlineKeyboardButton('3', switch_inline_query_current_chat='')
inline_btn_9 = InlineKeyboardButton('Назад ↩️',callback_data='Back')
inline_kb_full3 = InlineKeyboardMarkup(row_width=1).add(inline_btn_6,inline_btn_7,inline_btn_8,inline_btn_9)
Answer the question
In order to leave comments, you need to log in
@dp.message_handler(text=['Магазин'])
async def shop(message: types.Message):
await message.answer("Выберите подраздел: ", reply_markup=inline_kb_full2)
@dp.callback_query_handler(lambda c: c.data == 'A')
async def process_callback_button1(callback_query: types.CallbackQuery):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Нажата первая кнопка!', reply_markup=inline_kb_full3)
@dp.callback_query_handler(lambda c: c.data == 'A')
async def process_callback_button1(callback_query: types.CallbackQuery):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Нажата первая кнопка!', reply_markup=inline_kb_full3)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question