Привет! Вот тебе пример кода, дружище:
Программный код:
from aiogram import Bot, Dispatcher, types
from aiogram.utils import executor
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
API_TOKEN = 'YOUR_API_TOKEN'
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
# Создаем инлайн-клавиатуру
inline_kb_full = InlineKeyboardMarkup(row_width=2)
inline_btn_1 = InlineKeyboardButton('Button 1', callback_data='button1')
inline_btn_2 = InlineKeyboardButton('Button 2', callback_data='button2')
inline_kb_full.add(inline_btn_1, inline_btn_2)
@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
await message.reply("Hi!
I'm your bot!
Press buttons below.", reply_markup=inline_kb_full)
@dp.callback_query_handler(lambda c: c.data)
async def process_callback(callback_query: types.CallbackQuery):
await bot.answer_callback_query(callback_query.id, text=f'You clicked: {callback_query.data}')
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
Надеюсь, поможет!