-
Notifications
You must be signed in to change notification settings - Fork 1
InlineKeyboardMarkup
Eric Damian edited this page Feb 18, 2021
·
3 revisions
This object represents an inline keyboard that appears right next to the message it belongs to.
Field | Type | Description |
---|---|---|
inline_keyboard | Array of Array of InlineKeyboardButton | Array of button rows, each represented by an Array of InlineKeyboardButton objects |
Returns InlineKeyboardMarkup object
from python_telegram_api import bot_utils
button1 = bot_utils.getInlineKeyboardButtonWithUrl('Button 1', 'https://github.com/xSklero/python-telegram-api')
button2 = bot_utils.getInlineKeyboardButtonWithCallback('Button 2', '12')
button3 = bot_utils.getInlineKeyboardButtonWithSwichInline('Button 3', 'Use this bot!')
button4 = bot_utils.getInlineKeyboardButtonWithSwichInlineCurrentChat('Button 4', 'Use this bot!\n')
inline_keyboard = bot_utils.getInlineKeyboard([[button1, button2], [button3, button4]])
print(inline_keyboard)
>>> {'inline_keyboard': [[{'text': 'Button 1', 'url': 'https://github.com/xSklero/python-telegram-api'}, {'text': 'Button 2', 'callback_data': '12'}], [{'text': 'Button 3', 'switch_inline_query': 'Use this bot!'}, {'text': 'Button 4', 'switch_inline_query_current_chat': 'Use this bot!\n'}]]}