N
N
newbie632021-07-15 15:00:32
Python
newbie63, 2021-07-15 15:00:32

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, 'Нажата первая кнопка!')

I get an error: NameError: Invalid filter name(s): 'funk'
How to solve?
PS Replacement
@dp.callback_query_handler(func=lambda c: c.data == 'button1')

on the
@dp.callback_query_handler(lambda c: c.data == 'button1')

Does not help

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question