KeyboardButton

class pyrogram.types.KeyboardButton

One button of the reply keyboard.

For plain text buttons, a bare str can be used instead of this object. Optional fields are mutually exclusive.

Parameters:
  • text (str) – Button label. Sent as a message when pressed if no other field is set.

  • request_contact (bool, optional) – Send the user’s phone number when pressed. Private chats only.

  • request_location (bool, optional) – Send the user’s location when pressed. Private chats only.

  • request_poll (bool, optional) – Ask the user to create a poll when pressed. Private chats only.

  • request_poll_quiz (bool, optional) – Only when request_poll is True. True → quiz mode only, False → regular polls only, None → either.

  • request_chat (RequestPeerTypeChannel | RequestPeerTypeChat, optional) – Criteria for a chat/channel to share.

  • request_user (RequestPeerTypeUser, optional) – Criteria for a user to share.

  • request_managed_bot (RequestPeerTypeManagedBot, optional) – Request creation of a managed bot. Mini Apps only.

  • web_app (WebAppInfo, optional) – Web App launched when the button is pressed.

  • style (ButtonStyle, optional) – Visual colour: DEFAULT (none), PRIMARY (blue), DANGER (red), SUCCESS (green).

  • icon_custom_emoji_id (int, optional) – Custom emoji document ID shown on the button. 0 / None = no icon.