Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# KeyboardButtonRequestChat

class telegram.KeyboardButtonRequestChat(request_id, chat_is_channel, chat_is_forum=None, chat_has_username=None, chat_is_created=None, user_administrator_rights=None, bot_administrator_rights=None, bot_is_member=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object defines the criteria used to request a suitable chat. The identifier of the selected user will be shared with the bot when the corresponding button is pressed.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `request_id` is equal.

  Available In

  `telegram.KeyboardButton.request_chat`

  See also

  Telegram Docs on requesting chats

  New in version 20.1.

  Parameters:

    - request_id (`int`) – Signed 32-bit identifier of the request, which will be received back in the `telegram.ChatShared` object. Must be unique within the message.

    - chat_is_channel (`bool`) – Pass `True` to request a channel chat, pass `False` to request a group or a supergroup chat.

    - chat_is_forum (`bool`, optional) – Pass `True` to request a forum supergroup, pass `False` to request a non-forum chat. If not specified, no additional restrictions are applied.

    - chat_has_username (`bool`, optional) – Pass `True` to request a supergroup or a channel with a username, pass `False` to request a chat without a username. If not specified, no additional restrictions are applied.

    - chat_is_created (`bool`, optional) – Pass `True` to request a chat owned by the user. Otherwise, no additional restrictions are applied.

    - user_administrator_rights (`ChatAdministratorRights`, optional) – Specifies the required administrator rights of the user in the chat. If not specified, no additional restrictions are applied.

    - bot_administrator_rights (`ChatAdministratorRights`, optional) – Specifies the required administrator rights of the bot in the chat. The rights must be a subset of `user_administrator_rights`. If not specified, no additional restrictions are applied.

    - bot_is_member (`bool`, optional) – Pass `True` to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.

  request_id

    Identifier of the request.

    Type:

      `int`

  chat_is_channel

    Pass `True` to request a channel chat, pass `False` to request a group or a supergroup chat.

    Type:

      `bool`

  chat_is_forum

    Optional. Pass `True` to request a forum supergroup, pass `False` to request a non-forum chat. If not specified, no additional restrictions are applied.

    Type:

      `bool`

  chat_has_username

    Pass `True` to request a supergroup or a channel with a username, pass `False` to request a chat without a username. If not specified, no additional restrictions are applied.

    Type:

      `bool`, optional

  chat_is_created

    user. Otherwise, no additional restrictions are applied.

    Type:

      `bool`

  user_administrator_rights

    required administrator rights of the user in the chat. If not specified, no additional restrictions are applied.

    Type:

      `ChatAdministratorRights`

  bot_administrator_rights

    required administrator rights of the bot in the chat. The rights must be a subset of `user_administrator_rights`. If not specified, no additional restrictions are applied.

    Type:

      `ChatAdministratorRights`

  bot_is_member

    as a member. Otherwise, no additional restrictions are applied.

    Type:

      `bool`

  classmethod de_json(data, bot)

    See `telegram.TelegramObject.de_json()`.