o
    /h}                     @   s   d Z ddlmZmZ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rXd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    )TYPE_CHECKINGFinalOptionalSequenceTupleUnion)	constants)Location)MaybeInaccessibleMessageMessage)TelegramObject)User)DEFAULT_NONE)JSONDictODVInputReplyMarkup)BotGameHighScoreInlineKeyboardMarkup
InputMediaLinkPreviewOptionsMessageEntity	MessageIdReplyParametersc                &       s8  e Zd ZU dZdZ				dad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	dbd	ee	 ded ded  f fddZ				dae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dcd 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	dbe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	dbe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							ddd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	dbe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		dee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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d]f$d^d_Z%e&j'j(Z)e*e e+d`<   Z,S )f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,   r1      s   
zCallbackQuery.de_jsonread_timeoutwrite_timeoutconnect_timeoutpool_timeoutr#   text
show_alerturl
cache_timer6   r7   r8   r9   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_idr:   r;   r<   r=   r6   r7   r8   r9   r#   N)get_botanswer_callback_queryr   )
r(   r:   r;   r<   r=   r6   r7   r8   r9   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(   rC   r+   r+   r,   _get_message   s   zCallbackQuery._get_message)disable_web_page_previewr6   r7   r8   r9   r#   
parse_modereply_markupr   entitiesr   link_preview_optionsr   rG   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    r:   rH   rG   rK   rI   r6   r7   r8   r9   r#   rJ   chat_id
message_idbusiness_connection_id)r:   rH   rG   rK   rI   r6   r7   r8   r9   r#   rJ   )r    r?   edit_message_textrF   	edit_text)r(   r:   rH   rI   rJ   rK   rG   r6   r7   r8   r9   r#   r+   r+   r,   rO      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)rQ   r    rI   r6   r7   r8   r9   rH   r#   rR   rL   rM   rS   rN   )
rQ   rI   r6   r7   r8   r9   rH   r#   rR   rS   )r    r?   edit_message_captionrF   edit_caption)r(   rQ   rI   rH   rR   rS   r6   r7   r8   r9   r#   r+   r+   r,   rT     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)
rI   r    r6   r7   r8   r9   r#   rL   rM   rN   rI   r6   r7   r8   r9   r#   )r    r?   edit_message_reply_markuprF   edit_reply_markupr(   rI   r6   r7   r8   r9   r#   r+   r+   r,   rW   _  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    rZ   rI   r6   r7   r8   r9   r#   rL   rM   rN   )rZ   rI   r6   r7   r8   r9   r#   )r    r?   edit_message_mediarF   
edit_media)r(   rZ   rI   r6   r7   r8   r9   r#   r+   r+   r,   r[     s0   #z CallbackQuery.edit_message_media)locationr6   r7   r8   r9   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]   rI   r6   r7   r8   r9   r#   r`   ra   rb   rc   rL   NrM   rN   )r^   r_   r]   rI   r6   r7   r8   r9   r#   r`   ra   rb   rc   r+   )r    r?   edit_message_live_locationrF   edit_live_location)r(   r^   r_   rI   r`   ra   rb   rc   r]   r6   r7   r8   r9   r#   r+   r+   r,   rd     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    rI   r6   r7   r8   r9   r#   rL   rM   rN   rV   )r    r?   stop_message_live_locationrF   stop_live_locationrY   r+   r+   r,   rf   $  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    rh   ri   rj   rk   r6   r7   r8   r9   r#   rL   rM   )	rh   ri   rj   rk   r6   r7   r8   r9   r#   )r    r?   set_game_scorerF   )
r(   rh   ri   rj   rk   r6   r7   r8   r9   r#   r+   r+   r,   rl   ^  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    rh   r6   r7   r8   r9   r#   rL   rM   )rh   r6   r7   r8   r9   r#   )r    r?   get_game_high_scoresrF   )r(   rh   r6   r7   r8   r9   r#   r+   r+   r,   rm     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rC   r5   N)rF   ro   r(   r6   r7   r8   r9   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.
        pinrp   )rs   r6   r7   r8   r9   r#   N)rF   rt   )r(   rs   r6   r7   r8   r9   r#   r+   r+   r,   pin_message  s   zCallbackQuery.pin_messagec                   rn   )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.
        unpinrp   r5   N)rF   rv   rq   r+   r+   r,   unpin_message  s   zCallbackQuery.unpin_message)allow_sending_without_replyreply_to_message_idr6   r7   r8   r9   r#   rL   protect_contentmessage_thread_idreply_parametersr   rx   ry   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|
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.
        copyrp   rL   rQ   rH   rR   rs   ry   rx   rI   r6   r7   r8   r9   r#   rz   r{   r|   rS   Nr+   )rF   r}   )r(   rL   rQ   rH   rR   rs   rI   rz   r{   r|   rS   rx   ry   r6   r7   r8   r9   r#   r+   r+   r,   copy_message8  sH   )	

zCallbackQuery.copy_messageMAX_ANSWER_TEXT_LENGTH)NNNN)N)rB   )NNNNNNN)NN)-__name__
__module____qualname____doc__	__slots__strr   r   r
   r   r%   classmethodr1   r   boolintr   floatrA   r   rF   r   r   rO   rT   rW   r[   r	   rd   rf   rl   r   rm   rr   ru   rw   r   r~   r   CallbackQueryLimit!ANSWER_CALLBACK_QUERY_TEXT_LENGTHr   r   __annotations____classcell__r+   r+   r)   r,   r   ,   s8  
 D

	

%
	


J
	


G
	
=	


>



Q
	
>	


D	
:
#	
%
#

	

>r   N)"r   typingr   r   r   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    (