from pyrogram import InlineKeyboardButton, InlineKeyboardMarkup button1 = InlineKeyboardButton("Button 1", callback_data="button1") button2 = InlineKeyboardButton("Button 2", callback_data="button2") keyboard = [[button1, button2]] reply_markup = InlineKeyboardMarkup(keyboard) # send message with keyboard bot.send_message(chat_id=chat_id, text="Choose an option:", reply_markup=reply_markup)
from pyrogram import InlineKeyboardButton, InlineKeyboardMarkup button1 = InlineKeyboardButton("Website", url="https://www.example.com") button2 = InlineKeyboardButton("Contact Us", switch_inline_query="contact us") keyboard = [[button1], [button2]] reply_markup = InlineKeyboardMarkup(keyboard) # send message with keyboard bot.send_message(chat_id=chat_id, text="Click on the button to visit our website or contact us directly:", reply_markup=reply_markup)In this example, we create an inline keyboard with two buttons labeled "Website" and "Contact Us". The first button, when pressed, opens a URL in the user's browser. The second button, when pressed, initiates an inline query to the bot with "contact us" as the query string. Overall, the InlineKeyboardButton class in pyrogram provides an easy way to create interactive inline keyboards in a Python Telegram bot.