Y
Y
yasegor2021-09-11 02:03:55
Telegram
yasegor, 2021-09-11 02:03:55

How to change inline menu under the same message?

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)



#keyboards.py


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)


It is necessary that when I click on "A" I would have the following menu:

#keyboards.py

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)


What should I add to bot.py so that when I press one button in the menu, another menu appears under the same message ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Old_TyT, 2021-09-11
@yasegor

@dp.callback_query_handler(lambda c: c.data == 'A')
async def process_prank_call_callback(callback_query: types.CallbackQuery):
   await callback_query.message.edit_text("Выберите подраздел: ", reply_markup=kb.inline_kb_full3)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question