U
    gB$                     @   sx   d Z ddlmZmZ ddlmZ ddlmZmZ ddl	m
Z
 ddlmZ ddlmZ erdddlmZ G d	d
 d
e
ZdS )zIThis module contains an object that represents a Telegram KeyboardButton.    )TYPE_CHECKINGOptional)KeyboardButtonPollType)KeyboardButtonRequestChatKeyboardButtonRequestUsers)TelegramObject)JSONDict)
WebAppInfo)Botc                       s   e Zd ZdZdZdddeee ee ee ee	 ee
 ee ee d fddZedee ed ed  d	 fd
dZ  ZS )KeyboardButtonat  
    This object represents one button of the reply keyboard. At most one of the optional fields
    must be used to specify type of the button. For simple text buttons, :obj:`str`
    can be used instead of this object to specify text of the button.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`text`, :attr:`request_contact`, :attr:`request_location`,
    :attr:`request_poll`, :attr:`web_app`, :attr:`request_users` and :attr:`request_chat` are
    equal.

    Note:
        * Optional fields are mutually exclusive.
        * :attr:`request_contact` and :attr:`request_location` options will only work in Telegram
          versions released after 9 April, 2016. Older clients will display unsupported message.
        * :attr:`request_poll` option will only work in Telegram versions released after 23
          January, 2020. Older clients will display unsupported message.
        * :attr:`web_app` option will only work in Telegram versions released after 16 April, 2022.
          Older clients will display unsupported message.
        * :attr:`request_users` and :attr:`request_chat` options will only work in Telegram
          versions released after 3 February, 2023. Older clients will display unsupported
          message.

    .. versionchanged:: 21.0
       Removed deprecated argument and attribute ``request_user``.
    .. versionchanged:: 20.0
       :attr:`web_app` is considered as well when comparing objects of this type in terms of
       equality.
    .. versionchanged:: 20.5
       :attr:`request_users` and :attr:`request_chat` are considered as well when
       comparing objects of this type in terms of equality.

    Args:
        text (:obj:`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 (:obj:`bool`, optional): If :obj:`True`, the user's phone number will be
            sent as a contact when the button is pressed. Available in private chats only.
        request_location (:obj:`bool`, optional): If :obj:`True`, the user's current location will
            be sent when the button is pressed. Available in private chats only.
        request_poll (:class:`~telegram.KeyboardButtonPollType`, optional): If specified, the user
            will be asked to create a poll and send it to the bot when the button is pressed.
            Available in private chats only.
        web_app (:class:`~telegram.WebAppInfo`, optional): If specified, the described `Web App
            <https://core.telegram.org/bots/webapps>`_ will be launched when the button is pressed.
            The Web App will be able to send a :attr:`Message.web_app_data` service message.
            Available in private chats only.

            .. versionadded:: 20.0

        request_users (:class:`KeyboardButtonRequestUsers`, optional): If specified, pressing the
            button will open a list of suitable users. Tapping on any user will send its
            identifier to the bot in a :attr:`telegram.Message.users_shared` service message.
            Available in private chats only.

            .. versionadded:: 20.8
        request_chat (:class:`KeyboardButtonRequestChat`, optional): If specified, pressing the
            button will open a list of suitable chats. Tapping on a chat will send its
            identifier to the bot in a :attr:`telegram.Message.chat_shared` service message.
            Available in private chats only.

            .. versionadded:: 20.1
    Attributes:
        text (:obj:`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 (:obj:`bool`): Optional. If :obj:`True`, the user's phone number will be
            sent as a contact when the button is pressed. Available in private chats only.
        request_location (:obj:`bool`): Optional. If :obj:`True`, the user's current location will
            be sent when the button is pressed. Available in private chats only.
        request_poll (:class:`~telegram.KeyboardButtonPollType`): Optional. If specified,
            the user will be asked to create a poll and send it to the bot when the button is
            pressed. Available in private chats only.
        web_app (:class:`~telegram.WebAppInfo`): Optional. If specified, the described `Web App
            <https://core.telegram.org/bots/webapps>`_ will be launched when the button is pressed.
            The Web App will be able to send a :attr:`Message.web_app_data` service message.
            Available in private chats only.

            .. versionadded:: 20.0
        request_users (:class:`KeyboardButtonRequestUsers`): Optional. If specified, pressing the
            button will open a list of suitable users. Tapping on any user will send its
            identifier to the bot in a :attr:`telegram.Message.users_shared` service message.
            Available in private chats only.

            .. versionadded:: 20.8
        request_chat (:class:`KeyboardButtonRequestChat`): Optional. If specified, pressing the
            button will open a list of suitable chats. Tapping on a chat will send its
            identifier to the bot in a :attr:`telegram.Message.chat_shared` service message.
            Available in private chats only.

            .. versionadded:: 20.1
    )request_chatrequest_contactrequest_locationrequest_pollrequest_userstextweb_appN
api_kwargs)r   r   r   r   r   r   r   r   c          	         sf   t  j|d || _|| _|| _|| _|| _|| _|| _| j| j| j| j| j| j| jf| _	| 
  d S )Nr   )super__init__r   r   r   r   r   r   r   Z	_id_attrsZ_freeze)	selfr   r   r   r   r   r   r   r   	__class__ </tmp/pip-unpacked-wheel-swnnwir2/telegram/_keyboardbutton.pyr      s"    
zKeyboardButton.__init__r
   )databotreturnc                    s   |  |}|sdS t|d||d< t|d||d< t|d||d< t|d||d< i }|d }rd|i}t j|||dS )z,See :meth:`telegram.TelegramObject.de_json`.Nr   r   r   r   request_user)r   r   r   )	Z_parse_datar   de_jsongetr   r   r	   r   Z_de_json)clsr   r   r   r   r   r   r   r       s    
zKeyboardButton.de_json)NNNNNN)N)__name__
__module____qualname____doc__	__slots__strr   boolr   r	   r   r   r   r   classmethodr    __classcell__r   r   r   r   r   !   s6   Z      
$  r   N)r&   typingr   r   Z telegram._keyboardbuttonpolltyper   Ztelegram._keyboardbuttonrequestr   r   Ztelegram._telegramobjectr   Ztelegram._utils.typesr   Ztelegram._webappinfor	   Ztelegramr
   r   r   r   r   r   <module>   s   