Reputation: 43
How to fix error with aiogram 3.2.0
pydantic_core._pydantic_core.ValidationError: 1 validation error for InlineKeyboardMarkup
inline_keyboard Field required [type=missing, input_value={}, input_type=dict] For further information visit https://errors.pydantic.dev/2.3/v/missing
faq = InlineKeyboardButton(text = '📝FAQ', callback_data="faq")
event = InlineKeyboardButton(text = '‼️event‼️', callback_data='event')
prof = InlineKeyboardButton(text = '👥profile', callback_data='prof')
main_kb = InlineKeyboardMarkup().add(prof,event).add(faq)
Upvotes: 0
Views: 3811
Reputation: 16
Try:
main_kb = InlineKeyboardBuilder()
faq = InlineKeyboardButton(text = '📝FAQ', callback_data="faq")
event = InlineKeyboardButton(text = '‼️event‼️', callback_data='event')
prof = InlineKeyboardButton(text = '👥profile', callback_data='prof')
main_kb.add(faq, event, prof)
main_kb = main_kb.as_markup()
Or:
main_kb = InlineKeyboardMarkup(inline_keyboard=[
[InlineKeyboardButton(text = "📝FAQ", callback_data="faq"),
InlineKeyboardButton(text = "‼️event‼️", callback_data="event"),
InlineKeyboardButton(text = "👥profile", callback_data="prof")
]
],)
Upvotes: 0