Answer the question
In order to leave comments, you need to log in
Inline keyboard error. How to decide?
I found a tutorial on creating an Inline keyboard:
# keyboards.py
inline_btn_1 = InlineKeyboardButton('Первая кнопка!', callback_data='button1')
inline_kb1 = InlineKeyboardMarkup().add(inline_btn_1)
#bot.py
@dp.message_handler(commands=['1'])
async def process_command_1(message: types.Message):
await message.reply("Первая инлайн кнопка", reply_markup=kb.inline_kb1)
@dp.callback_query_handler(func=lambda c: c.data == 'button1')
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, 'Нажата первая кнопка!')
@dp.callback_query_handler(func=lambda c: c.data == 'button1')
@dp.callback_query_handler(lambda c: c.data == 'button1')
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