o
    "h                     @   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 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 ddlmZmZmZmZ erhd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)InputChecklist)MaybeInaccessibleMessageMessage)TelegramObject)User)de_json_optional)DEFAULT_NONE)JSONDictODVInputReplyMarkup
TimePeriod)BotGameHighScoreInlineKeyboardMarkup
InputMediaLinkPreviewOptionsMessageEntity	MessageIdReplyParametersc                *       s  e Zd ZU dZdZ				dfd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dgd	e	ded dd f fddZ				dfe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dhd 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	dgeeeeddd3ed%ed& dee dee dee dee dee	 deeef fd4d5Z	dge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d6d7Z	dgeeeeddd8d9d%ed& dee dee dee dee dee	 deeef fd:d;Z							dideeeedd<d=ee d>ee d%ed& d?ee d@ee dAee dBee dCee dee dee dee dee dee	 deeef fdDdEZ	dge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dFdGZ 		djeeeedddHedIedJee dKee dee dee dee dee dee	 deeef fdLdMZ!eeeedddHedee dee dee dee dee	 de"dN fdOdP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dQdRZ$efeeeedddSee dee dee dee dee dee	 defdTdU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dVdWZ&dedededddddfedeeeeddXdYeeef d.ee d$ee d/eed(  dSee d%ee' dZee d[ee d\ed] d0ee d^ee d_ee d`ee daee dee dee dee dee dee	 ddbf(dcddZ(e)j*j+Z,e-e e.de<   Z/S )k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__ J/var/www/html/venv/lib/python3.10/site-packages/telegram/_callbackquery.pyr'   ~   s   
zCallbackQuery.__init__botr   returnc                    sH   |  |}t|ddt||d< t|dt||d< t j||dS )z,See :meth:`telegram.TelegramObject.de_json`.fromNr   r#   )r   r/   )_parse_datar   popr   getr   r&   de_json)clsr   r/   r+   r-   r.   r5      s   
zCallbackQuery.de_jsonread_timeoutwrite_timeoutconnect_timeoutpool_timeoutr%   text
show_alerturl
cache_timer8   r9   r:   r;   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?   r8   r9   r:   r;   r%   N)get_botanswer_callback_queryr!   )
r*   r<   r=   r>   r?   r8   r9   r:   r;   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*   rE   r-   r-   r.   _get_message   s   zCallbackQuery._get_message)disable_web_page_previewr8   r9   r:   r;   r%   
parse_modereply_markupr   entitiesr   link_preview_optionsr   rI   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<   rJ   rI   rM   rK   r8   r9   r:   r;   r%   rL   chat_id
message_idbusiness_connection_id)r<   rJ   rI   rM   rK   r8   r9   r:   r;   r%   rL   )r"   rA   edit_message_textrH   	edit_text)r*   r<   rJ   rK   rL   rM   rI   r8   r9   r:   r;   r%   r-   r-   r.   rQ      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)rS   r"   rK   r8   r9   r:   r;   rJ   r%   rT   rN   rO   rU   rP   )
rS   rK   r8   r9   r:   r;   rJ   r%   rT   rU   )r"   rA   edit_message_captionrH   edit_caption)r*   rS   rK   rJ   rT   rU   r8   r9   r:   r;   r%   r-   r-   r.   rV     s<   &z"CallbackQuery.edit_message_caption	checklistc             	      s$   |   j|||||||dI dH S )a  Shortcut for::

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

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

        .. versionadded:: 22.3

        Returns:
            :class:`telegram.Message`: On success, the edited Message is returned.

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

        )rX   rK   r8   r9   r:   r;   r%   N)rH   edit_checklist)r*   rX   rK   r8   r9   r:   r;   r%   r-   r-   r.   edit_message_checklist]  s   z$CallbackQuery.edit_message_checklistc                   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)
rK   r"   r8   r9   r:   r;   r%   rN   rO   rP   rK   r8   r9   r:   r;   r%   )r"   rA   edit_message_reply_markuprH   edit_reply_markupr*   rK   r8   r9   r:   r;   r%   r-   r-   r.   r\     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"   r_   rK   r8   r9   r:   r;   r%   rN   rO   rP   )r_   rK   r8   r9   r:   r;   r%   )r"   rA   edit_message_mediarH   
edit_media)r*   r_   rK   r8   r9   r:   r;   r%   r-   r-   r.   r`     s0   #z CallbackQuery.edit_message_media)locationr8   r9   r:   r;   r%   latitude	longitudehorizontal_accuracyheadingproximity_alert_radiuslive_periodrb   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"   rc   rd   rb   rK   r8   r9   r:   r;   r%   re   rf   rg   rh   rN   NrO   rP   )rc   rd   rb   rK   r8   r9   r:   r;   r%   re   rf   rg   rh   r-   )r"   rA   edit_message_live_locationrH   edit_live_location)r*   rc   rd   rK   re   rf   rg   rh   rb   r8   r9   r:   r;   r%   r-   r-   r.   ri     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"   rK   r8   r9   r:   r;   r%   rN   rO   rP   r[   )r"   rA   stop_message_live_locationrH   stop_live_locationr^   r-   r-   r.   rk   G  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"   rm   rn   ro   rp   r8   r9   r:   r;   r%   rN   rO   )	rm   rn   ro   rp   r8   r9   r:   r;   r%   )r"   rA   set_game_scorerH   )
r*   rm   rn   ro   rp   r8   r9   r:   r;   r%   r-   r-   r.   rq     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"   rm   r8   r9   r:   r;   r%   rN   rO   )rm   r8   r9   r:   r;   r%   )r"   rA   get_game_high_scoresrH   )r*   rm   r8   r9   r:   r;   r%   r-   r-   r.   rr     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rE   r7   N)rH   rt   r*   r8   r9   r:   r;   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.
        pinru   )rx   r8   r9   r:   r;   r%   N)rH   ry   )r*   rx   r8   r9   r:   r;   r%   r-   r-   r.   pin_message  s   zCallbackQuery.pin_messagec                   rs   )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.
        unpinru   r7   N)rH   r{   rv   r-   r-   r.   unpin_message;  s   zCallbackQuery.unpin_message)allow_sending_without_replyreply_to_message_idr8   r9   r:   r;   r%   rN   protect_contentmessage_thread_idreply_parametersr   allow_paid_broadcastvideo_start_timestampr}   r~   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|
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.
        copyru   rN   rS   rJ   r   rT   rx   r~   r}   rK   r8   r9   r:   r;   r%   r   r   r   rU   r   Nr-   )rH   r   )r*   rN   rS   rJ   rT   rx   rK   r   r   r   rU   r   r   r}   r~   r8   r9   r:   r;   r%   r-   r-   r.   copy_message[  sP   +	

zCallbackQuery.copy_messageMAX_ANSWER_TEXT_LENGTH)NNNN)N)rD   )NNNNNNN)NN)0__name__
__module____qualname____doc__	__slots__strr   r   r
   r   r'   classmethodr5   r   boolr   r   floatrC   r   rH   r   r   rQ   rV   r	   rZ   r\   r`   intr   ri   rk   rq   tuplerr   rw   rz   r|   r   r   r   CallbackQueryLimit!ANSWER_CALLBACK_QUERY_TEXT_LENGTHr   r   __annotations____classcell__r-   r-   r+   r.   r   /   sf  
 D

"	

%
	


J
	


H	


'
	
=	


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