-
I am using the InlineKeyboardBuilder to create buttons and CallbackData to set data. I am using CallbackQuery to filter this data with callback.filter(). However, when I click on the buttons, nothing happens - not even in the logs - and no error appears. It seems as if nothing is really happening. I have attempted all possible methods that I am aware of by following the documentation, but I have not been able to achieve the desired outcome. As a newcomer to aiogram, it is possible that I have made a trivial error. However, after spending several hours reviewing the documentation and searching for solutions on GitHub and Telegram groups, I have decided to seek assistance. router = Router(name="callback")
class MyCallback(CallbackData, prefix="testcbdata"):
test: str
@router.message(Command("test"))
async def language(message: Message):
keyboard = InlineKeyboardBuilder()
keyboard.button(text="Test", callback_data=MyCallback(test="f"))
keyboard.adjust(4)
await message.reply("Just a test", reply_markup=keyboard.as_markup())
@router.callback_query(MyCallback.filter())
async def language_callback(callback: CallbackQuery):
await callback.answer("Hi", show_alert=True) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I found out what was causing the CallbackQuery to be ignored, was that I set |
Beta Was this translation helpful? Give feedback.
-
In aiogram==3.0.0b7 do not forget to alter |
Beta Was this translation helpful? Give feedback.
I found out what was causing the CallbackQuery to be ignored, was that I set
bot.delete_webhook(drop_pending_updates=True)
for the bot to ignore updates from when it was off, this is probably not the right way to do it.