U
    2Òtc›  ã                   @   s\   d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
 erHddlmZ G dd„ deƒZdS )	zIThis module contains an object that represents a Telegram KeyboardButton.é    )ÚTYPE_CHECKINGÚAnyÚOptional)ÚTelegramObjectÚKeyboardButtonPollTypeÚ
WebAppInfo)ÚJSONDict)ÚBotc                   @   sL   e Zd ZdZdZdeeeeee	dœdd„Z
eee ded  dœd	d
„ƒZdS )ÚKeyboardButtona>
  
    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.

    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` and
    :attr:`request_poll` 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 receive unsupported message.
        * :attr:`web_app` option will only work in Telegram versions released after 16 April, 2022.
          Older clients will display unsupported message.

    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:`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:`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:: 13.12

    Attributes:
        text (:obj:`str`): Text of the button.
        request_contact (:obj:`bool`): Optional. The user's phone number will be sent.
        request_location (:obj:`bool`): Optional. The user's current location will be sent.
        request_poll (:class:`KeyboardButtonPollType`): Optional. If the user should create a poll.
        web_app (:class:`WebAppInfo`): Optional. If the described Web App will be launched when the
            button is pressed.

            .. versionadded:: 13.12
    )Úrequest_locationÚrequest_contactÚrequest_pollÚtextÚweb_appÚ	_id_attrsN)r   r   r   r   r   Ú_kwargsc                 K   s8   || _ || _|| _|| _|| _| j | j| j| jf| _d S )N)r   r   r   r   r   r   )Úselfr   r   r   r   r   r   © r   ú;/tmp/pip-unpacked-wheel-2u9rcp5s/telegram/keyboardbutton.pyÚ__init__U   s    
üzKeyboardButton.__init__r	   )ÚdataÚbotÚreturnc                 C   sH   |   |¡}|sdS t | d¡|¡|d< t | d¡|¡|d< | f |ŽS )z,See :meth:`telegram.TelegramObject.de_json`.Nr   r   )Z_parse_datar   Úde_jsonÚgetr   )Úclsr   r   r   r   r   r   m   s    
zKeyboardButton.de_json)NNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__ÚstrÚboolr   r   r   r   Úclassmethodr   r   r   r   r   r   r   r
      s    -    úùr
   N)r   Útypingr   r   r   Ztelegramr   r   r   Ztelegram.utils.typesr   r	   r
   r   r   r   r   Ú<module>   s   