telegram.KeyboardButton¶
-
class
telegram.
KeyboardButton
(text, request_contact=None, request_location=None, **kwargs)¶ Bases:
telegram.base.TelegramObject
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.
Note
Optional fields are mutually exclusive.
-
text
¶ Text of the button.
Type: str
-
request_contact
¶ Optional. If the user’s phone number will be sent.
Type: bool
-
request_location
¶ Optional. If the user’s current location will be sent.
Type: bool
Parameters: - text (
str
) – Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed. - request_contact (
bool
, optional) – If True, the user’s phone number will be sent as a contact when the button is pressed. Available in private chats only. - request_location (
bool
, optional) – If True, the user’s current location will be sent when the button is pressed. Available in private chats only.
Note
request_contact
andrequest_location
options will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.-