MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / KeyboardButton

Class KeyboardButton

telebot/types.py:3018–3116  ·  view source on GitHub ↗

This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive. Telegram Documentation: https://cor

Source from the content-addressed store, hash-verified

3016
3017
3018class KeyboardButton(Dictionaryable, JsonSerializable):
3019 """
3020 This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive.
3021
3022 Telegram Documentation: https://core.telegram.org/bots/api#keyboardbutton
3023
3024 :param text: Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used,
3025 it will be sent as a message when the button is pressed
3026 :type text: :obj:`str`
3027
3028 :param icon_custom_emoji_id: Optional. Unique identifier of the custom emoji shown before the text of the button.
3029 Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats
3030 if the owner of the bot has a Telegram Premium subscription.
3031 :type icon_custom_emoji_id: :obj:`str`
3032
3033 :param style: Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
3034 :type style: :obj:`str`
3035
3036 :param request_contact: Optional. If True, the user's phone number will be sent as a contact when the button is
3037 pressed. Available in private chats only.
3038 :type request_contact: :obj:`bool`
3039
3040 :param request_location: Optional. If True, the user's current location will be sent when the button is pressed.
3041 Available in private chats only.
3042 :type request_location: :obj:`bool`
3043
3044 :param request_poll: Optional. If specified, the user will be asked to create a poll and send it to the bot when the
3045 button is pressed. Available in private chats only.
3046 :type request_poll: :class:`telebot.types.KeyboardButtonPollType`
3047
3048 :param web_app: Optional. If specified, the described Web App will be launched when the button is pressed. The Web App
3049 will be able to send a “web_app_data” service message. Available in private chats only.
3050 :type web_app: :class:`telebot.types.WebAppInfo`
3051
3052 :param request_user: deprecated
3053 :type request_user: :class:`telebot.types.KeyboardButtonRequestUser`
3054
3055 :param request_users: Optional. If specified, pressing the button will open a list of suitable users.
3056 Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
3057 :type request_users: :class:`telebot.types.KeyboardButtonRequestUsers`
3058
3059 :param request_chat: Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will
3060 send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
3061 :type request_chat: :class:`telebot.types.KeyboardButtonRequestChat`
3062
3063 :param request_managed_bot: Optional. If specified, pressing the button will ask the user to create and share a bot
3064 that will be managed by the current bot. Available for bots that enabled management of other bots in the @BotFather
3065 Mini App. Available in private chats only.
3066 :type request_managed_bot: :class:`telebot.types.KeyboardButtonRequestManagedBot`
3067
3068 :return: Instance of the class
3069 :rtype: :class:`telebot.types.KeyboardButton`
3070 """
3071 def __init__(self, text: str, request_contact: Optional[bool]=None,
3072 request_location: Optional[bool]=None, request_poll: Optional[KeyboardButtonPollType]=None,
3073 web_app: Optional[WebAppInfo]=None, request_user: Optional[KeyboardButtonRequestUser]=None,
3074 request_chat: Optional[KeyboardButtonRequestChat]=None, request_users: Optional[KeyboardButtonRequestUsers]=None,
3075 icon_custom_emoji_id: Optional[str]=None, style: Optional[str]=None, request_managed_bot: Optional[KeyboardButtonRequestManagedBot]=None):

Callers 5

startFunction · 0.90
keyboardFunction · 0.90
menu_keyboardFunction · 0.90
startFunction · 0.90
menu_keyboardFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…