o
    GCh                     @   s   d Z ddlmZ ddlmZmZmZmZ ddl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 dd
lmZmZmZ erZddlmZmZmZmZmZmZmZm Z  G dd deZ!dS )zGThis module contains an object that represents a Telegram CallbackQuery    )Sequence)TYPE_CHECKINGFinalOptionalUnion)	constants)Location)MaybeInaccessibleMessageMessage)TelegramObject)User)DEFAULT_NONE)JSONDictODVInputReplyMarkup)BotGameHighScoreInlineKeyboardMarkup
InputMediaLinkPreviewOptionsMessageEntity	MessageIdReplyParametersc                (       sB  e Zd ZU dZdZ				dbdddedededee d	ee d
ee dee dee	 f fddZ
e	dcd	ee	 ded ded  f fddZ				dbeeeedddee dee dee dee dee dee dee dee dee	 defddZddd edefd!d"Zeddefdeeeedd#ded$ee d%ed& d'eed(  d)ed* d+ee dee dee dee dee dee	 deeef fd,d-Zddeddfeeeeddd.ee d%ed& d$ee d/eed(  d0ee dee dee dee dee dee	 deeef fd1d2Z	dceeeeddd%ed& dee dee dee dee dee	 deeef fd3d4Z	dceeeeddd5d6d%ed& dee dee dee dee dee	 deeef fd7d8Z							dedeeeedd9d:ee d;ee d%ed& d<ee d=ee d>ee d?ee d@ee dee dee dee dee dee	 deeef fdAdBZ	dceeeeddd%ed& dee dee dee dee dee	 deeef fdCdDZ		dfeeeedddEedFedGee dHee dee dee dee dee dee	 deeef fdIdJZeeeedddEedee dee dee dee dee	 dedK fdLdMZ eeeedddee dee dee dee dee	 defdNdOZ!efeeeedddPee dee dee dee dee dee	 defdQdRZ"eeeedddee dee dee dee dee	 defdSdTZ#dedededdddf
edeeeeddUdVeeef d.ee d$ee d/eed(  dPee d%ee$ dWee dXee dYedZ d0ee d[ee d\ee d]ee dee dee dee dee dee	 dd^f&d_d`Z%e&j'j(Z)e*e e+da<   Z,S )gCallbackQuerya(  
    This object represents an incoming callback query from a callback button in an inline keyboard.

    If the button that originated the query was attached to a message sent by the bot, the field
    :attr:`message` will be present. If the button was attached to a message sent via the bot (in
    inline mode), the field :attr:`inline_message_id` will be present.

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

    Note:
        * In Python :keyword:`from` is a reserved word. Use :paramref:`from_user` instead.
        * Exactly one of the fields :attr:`data` or :attr:`game_short_name` will be present.
        * After the user presses an inline button, Telegram clients will display a progress bar
          until you call :attr:`answer`. It is, therefore, necessary to react
          by calling :attr:`telegram.Bot.answer_callback_query` even if no notification to the user
          is needed (e.g., without specifying any of the optional parameters).
        * If you're using :attr:`telegram.ext.ExtBot.callback_data_cache`, :attr:`data` may be
          an instance
          of :class:`telegram.ext.InvalidCallbackData`. This will be the case, if the data
          associated with the button triggering the :class:`telegram.CallbackQuery` was already
          deleted or if :attr:`data` was manipulated by a malicious client.

          .. versionadded:: 13.6

    Args:
        id (:obj:`str`): Unique identifier for this query.
        from_user (:class:`telegram.User`): Sender.
        chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which
            the message with the callback button was sent. Useful for high scores in games.
        message (:class:`telegram.MaybeInaccessibleMessage`, optional): Message sent by the bot
            with the callback button that originated the query.

            .. versionchanged:: 20.8
               Accept objects of type :class:`telegram.MaybeInaccessibleMessage` since Bot API 7.0.
        data (:obj:`str`, optional): Data associated with the callback button. Be aware that the
            message, which originated the query, can contain no callback buttons with this data.
        inline_message_id (:obj:`str`, optional): Identifier of the message sent via the bot in
            inline mode, that originated the query.
        game_short_name (:obj:`str`, optional): Short name of a Game to be returned, serves as
            the unique identifier for the game.

    Attributes:
        id (:obj:`str`): Unique identifier for this query.
        from_user (:class:`telegram.User`): Sender.
        chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which
            the message with the callback button was sent. Useful for high scores in games.
        message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message sent by the bot
            with the callback button that originated the query.

            .. versionchanged:: 20.8
               Objects may be of type :class:`telegram.MaybeInaccessibleMessage` since Bot API
               7.0.
        data (:obj:`str` | :obj:`object`): Optional. Data associated with the callback button.
            Be aware that the message, which originated the query, can contain no callback buttons
            with this data.

            Tip:
                The value here is the same as the value passed in
                :paramref:`telegram.InlineKeyboardButton.callback_data`.
        inline_message_id (:obj:`str`): Optional. Identifier of the message sent via the bot in
            inline mode, that originated the query.
        game_short_name (:obj:`str`): Optional. Short name of a Game to be returned, serves as
            the unique identifier for the game.


    )chat_instancedata	from_usergame_short_nameidinline_message_idmessageN
api_kwargsr   r   r   r    r   r   r   r"   c          	         sN   t  j|d || _|| _|| _|| _|| _|| _|| _| jf| _	| 
  d S )Nr!   )super__init__r   r   r   r    r   r   r   	_id_attrs_freeze)	selfr   r   r   r    r   r   r   r"   	__class__ P/var/www/html/govbot/env/lib/python3.10/site-packages/telegram/_callbackquery.pyr$   |   s   
zCallbackQuery.__init__botr   returnc                    sP   |  |}|s	dS t|dd||d< t|d||d< t j||dS )z,See :meth:`telegram.TelegramObject.de_json`.Nfromr   r    )r   r,   )_parse_datar   de_jsonpopr
   getr#   )clsr   r,   r(   r*   r+   r0      s   
zCallbackQuery.de_jsonread_timeoutwrite_timeoutconnect_timeoutpool_timeoutr"   text
show_alerturl
cache_timer5   r6   r7   r8   c          
         s,   |   j| j|||||||||	d
I dH S )a1  Shortcut for::

             await bot.answer_callback_query(update.callback_query.id, *args, **kwargs)

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.answer_callback_query`.

        Returns:
            :obj:`bool`: On success, :obj:`True` is returned.

        )
callback_query_idr9   r:   r;   r<   r5   r6   r7   r8   r"   N)get_botanswer_callback_queryr   )
r'   r9   r:   r;   r<   r5   r6   r7   r8   r"   r*   r*   r+   answer   s   zCallbackQuery.answereditactionc                 C   s"   t | jtstd| d| jS )zHelper method to get the message for the shortcut methods. Must be called only
        if :attr:`inline_message_id` is *not* set.
        zCannot z an inaccessible message)
isinstancer    r
   	TypeError)r'   rB   r*   r*   r+   _get_message   s   zCallbackQuery._get_message)disable_web_page_previewr5   r6   r7   r8   r"   
parse_modereply_markupr   entitiesr   link_preview_optionsr   rF   c                   sf   | j r|  j| j ||||||||	|
||ddddI dH S |  j||||||||	|
||dI dH S )a  Shortcut for either::

            await update.callback_query.message.edit_text(*args, **kwargs)

        or::

            await bot.edit_message_text(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs,
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.edit_message_text` and :meth:`telegram.Message.edit_text`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is sent by the bot, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)r   r9   rG   rF   rJ   rH   r5   r6   r7   r8   r"   rI   chat_id
message_idbusiness_connection_id)r9   rG   rF   rJ   rH   r5   r6   r7   r8   r"   rI   )r   r>   edit_message_textrE   	edit_text)r'   r9   rG   rH   rI   rJ   rF   r5   r6   r7   r8   r"   r*   r*   r+   rN      s@   'zCallbackQuery.edit_message_textcaptioncaption_entitiesshow_caption_above_mediac                   sb   | j r|  j|| j |||||	||
|dd|ddI dH S |  j||||||	||
||d
I dH S )a%  Shortcut for either::

            await update.callback_query.message.edit_caption(*args, **kwargs)

        or::

            await bot.edit_message_caption(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs,
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.edit_message_caption` and :meth:`telegram.Message.edit_caption`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is sent by the bot, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)rP   r   rH   r5   r6   r7   r8   rG   r"   rQ   rK   rL   rR   rM   )
rP   rH   r5   r6   r7   r8   rG   r"   rQ   rR   )r   r>   edit_message_captionrE   edit_caption)r'   rP   rH   rG   rQ   rR   r5   r6   r7   r8   r"   r*   r*   r+   rS     s<   &z"CallbackQuery.edit_message_captionc                   sR   | j r|  j|| j |||||dddd
I dH S |  j||||||dI dH S )a@  Shortcut for either::

            await update.callback_query.message.edit_reply_markup(*args, **kwargs)

        or::

            await bot.edit_message_reply_markup(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.edit_message_reply_markup` and
        :meth:`telegram.Message.edit_reply_markup`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is sent by the bot, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)
rH   r   r5   r6   r7   r8   r"   rK   rL   rM   rH   r5   r6   r7   r8   r"   )r   r>   edit_message_reply_markuprE   edit_reply_markupr'   rH   r5   r6   r7   r8   r"   r*   r*   r+   rV   `  s,   #z'CallbackQuery.edit_message_reply_markupmediar   c                   sV   | j r|  j| j |||||||ddddI dH S |  j|||||||dI dH S )a"  Shortcut for either::

            await update.callback_query.message.edit_media(*args, **kwargs)

        or::

            await bot.edit_message_media(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.edit_message_media` and :meth:`telegram.Message.edit_media`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is not an inline message, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)r   rY   rH   r5   r6   r7   r8   r"   rK   rL   rM   )rY   rH   r5   r6   r7   r8   r"   )r   r>   edit_message_mediarE   
edit_media)r'   rY   rH   r5   r6   r7   r8   r"   r*   r*   r+   rZ     s0   #z CallbackQuery.edit_message_media)locationr5   r6   r7   r8   r"   latitude	longitudehorizontal_accuracyheadingproximity_alert_radiuslive_periodr\   c                   s   | j rC|  jdi d| j d|d|d|d|d|	d|
d|d	|d
|d|d|d|d|ddddddI dH S |  j|||||	|
|||||||dI dH S )aD  Shortcut for either::

            await update.callback_query.message.edit_live_location(*args, **kwargs)

        or::

            await bot.edit_message_live_location(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.edit_message_live_location` and
        :meth:`telegram.Message.edit_live_location`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is sent by the bot, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        r   r]   r^   r\   rH   r5   r6   r7   r8   r"   r_   r`   ra   rb   rK   NrL   rM   )r]   r^   r\   rH   r5   r6   r7   r8   r"   r_   r`   ra   rb   r*   )r   r>   edit_message_live_locationrE   edit_live_location)r'   r]   r^   rH   r_   r`   ra   rb   r\   r5   r6   r7   r8   r"   r*   r*   r+   rc     sh   *	

z(CallbackQuery.edit_message_live_locationc                   sR   | j r|  j| j ||||||dddd
I dH S |  j||||||dI dH S )aD  Shortcut for either::

            await update.callback_query.message.stop_live_location(*args, **kwargs)

        or::

            await bot.stop_message_live_location(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.stop_message_live_location` and
        :meth:`telegram.Message.stop_live_location`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is sent by the bot, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)
r   rH   r5   r6   r7   r8   r"   rK   rL   rM   rU   )r   r>   stop_message_live_locationrE   stop_live_locationrX   r*   r*   r+   re   %  s,   #z(CallbackQuery.stop_message_live_locationuser_idscoreforcedisable_edit_messagec          
         s\   | j r|  j| j |||||||||	dddI dH S |  j|||||||||	d	I dH S )a  Shortcut for either::

           await update.callback_query.message.set_game_score(*args, **kwargs)

        or::

            await bot.set_game_score(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.set_game_score` and :meth:`telegram.Message.set_game_score`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.Message`: On success, if edited message is sent by the bot, the
            edited Message is returned, otherwise :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)r   rg   rh   ri   rj   r5   r6   r7   r8   r"   rK   rL   )	rg   rh   ri   rj   r5   r6   r7   r8   r"   )r   r>   set_game_scorerE   )
r'   rg   rh   ri   rj   r5   r6   r7   r8   r"   r*   r*   r+   rk   _  s6   %zCallbackQuery.set_game_score)r   .c                   sP   | j r|  j| j ||||||ddd	I dH S |  j||||||dI dH S )a  Shortcut for either::

            await update.callback_query.message.get_game_high_score(*args, **kwargs)

        or::

            await bot.get_game_high_scores(
                inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
            )

        For the documentation of the arguments, please see
        :meth:`telegram.Bot.get_game_high_scores` and
        :meth:`telegram.Message.get_game_high_scores`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            tuple[:class:`telegram.GameHighScore`]

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        N)	r   rg   r5   r6   r7   r8   r"   rK   rL   )rg   r5   r6   r7   r8   r"   )r   r>   get_game_high_scoresrE   )r'   rg   r5   r6   r7   r8   r"   r*   r*   r+   rl     s*   "z"CallbackQuery.get_game_high_scoresc                   $   | j ddj|||||dI dH S )a  Shortcut for::

            await update.callback_query.message.delete(*args, **kwargs)

        For the documentation of the arguments, please see :meth:`telegram.Message.delete`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :obj:`bool`: On success, :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.

        deleterB   r4   N)rE   rn   r'   r5   r6   r7   r8   r"   r*   r*   r+   delete_message  s   zCallbackQuery.delete_messagedisable_notificationc                   s&   | j ddj||||||dI dH S )a  Shortcut for::

            await update.callback_query.message.pin(*args, **kwargs)

        For the documentation of the arguments, please see :meth:`telegram.Message.pin`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :obj:`bool`: On success, :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.
        pinro   )rr   r5   r6   r7   r8   r"   N)rE   rs   )r'   rr   r5   r6   r7   r8   r"   r*   r*   r+   pin_message  s   zCallbackQuery.pin_messagec                   rm   )a  Shortcut for::

            await update.callback_query.message.unpin(*args, **kwargs)

        For the documentation of the arguments, please see :meth:`telegram.Message.unpin`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :obj:`bool`: On success, :obj:`True` is returned.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.
        unpinro   r4   N)rE   ru   rp   r*   r*   r+   unpin_message  s   zCallbackQuery.unpin_message)allow_sending_without_replyreply_to_message_idr5   r6   r7   r8   r"   rK   protect_contentmessage_thread_idreply_parametersr   allow_paid_broadcastrw   rx   r   c                   s   | j ddjdi d|d|d|d|d|d|d	|d
|d|d|d|d|d|d|d|d|	d|
d|I dH S )a  Shortcut for::

            await update.callback_query.message.copy(
                from_chat_id=update.message.chat_id,
                message_id=update.message.message_id,
                *args,
                **kwargs
            )

        For the documentation of the arguments, please see :meth:`telegram.Message.copy`.

        .. versionchanged:: 20.8
           Raises :exc:`TypeError` if :attr:`message` is not accessible.

        Returns:
            :class:`telegram.MessageId`: On success, returns the MessageId of the sent message.

        Raises:
            :exc:`TypeError` if :attr:`message` is not accessible.
        copyro   rK   rP   rG   rQ   rr   rx   rw   rH   r5   r6   r7   r8   r"   ry   rz   r{   rR   r|   Nr*   )rE   r}   )r'   rK   rP   rG   rQ   rr   rH   ry   rz   r{   rR   r|   rw   rx   r5   r6   r7   r8   r"   r*   r*   r+   copy_message9  sL   *	

zCallbackQuery.copy_messageMAX_ANSWER_TEXT_LENGTH)NNNN)N)rA   )NNNNNNN)NN)-__name__
__module____qualname____doc__	__slots__strr   r   r	   r   r$   classmethodr0   r   boolintr   floatr@   r
   rE   r   r   rN   rS   rV   rZ   r   rc   re   rk   tuplerl   rq   rt   rv   r   r~   r   CallbackQueryLimit!ANSWER_CALLBACK_QUERY_TEXT_LENGTHr   r   __annotations____classcell__r*   r*   r(   r+   r   -   s>  
 D

	

%
	


J
	


G
	
=	


>



Q
	
>	


D	
:
#	
%
#

	

@r   N)"r   collections.abcr   typingr   r   r   r   telegramr   telegram._files.locationr   telegram._messager	   r
   telegram._telegramobjectr   telegram._userr   telegram._utils.defaultvaluer   telegram._utils.typesr   r   r   r   r   r   r   r   r   r   r   r   r*   r*   r*   r+   <module>   s   (