o
    N,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rjddlmZ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ReplyParametersSuggestedPostParametersc                ,       s  e Zd ZU dZdZ				dhd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did	e	ded dd f fddZ				dhe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djd 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	die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	die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	die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							dkd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	die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 		dle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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da dbee dcee dee dee dee dee dee	 dddf*dedfZ(e)j*j+Z,e-e e.dg<   Z/S )m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__ c/var/www/www-root/data/www/bot.pdev.uz/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   r0   )_parse_datar   popr   getr   r'   de_json)clsr   r0   r,   r.   r/   r6      s   
zCallbackQuery.de_jsonread_timeoutwrite_timeoutconnect_timeoutpool_timeoutr&   text
show_alerturl
cache_timer9   r:   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@   r9   r:   r;   r<   r&   N)get_botanswer_callback_queryr"   )
r+   r=   r>   r?   r@   r9   r:   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+   rF   r.   r.   r/   _get_message   s   zCallbackQuery._get_message)disable_web_page_previewr9   r:   r;   r<   r&   
parse_modereply_markupr   entitiesr   link_preview_optionsr   rJ   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=   rK   rJ   rN   rL   r9   r:   r;   r<   r&   rM   chat_id
message_idbusiness_connection_id)r=   rK   rJ   rN   rL   r9   r:   r;   r<   r&   rM   )r#   rB   edit_message_textrI   	edit_text)r+   r=   rK   rL   rM   rN   rJ   r9   r:   r;   r<   r&   r.   r.   r/   rR      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)rT   r#   rL   r9   r:   r;   r<   rK   r&   rU   rO   rP   rV   rQ   )
rT   rL   r9   r:   r;   r<   rK   r&   rU   rV   )r#   rB   edit_message_captionrI   edit_caption)r+   rT   rL   rK   rU   rV   r9   r:   r;   r<   r&   r.   r.   r/   rW     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.

        )rY   rL   r9   r:   r;   r<   r&   N)rI   edit_checklist)r+   rY   rL   r9   r:   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)
rL   r#   r9   r:   r;   r<   r&   rO   rP   rQ   rL   r9   r:   r;   r<   r&   )r#   rB   edit_message_reply_markuprI   edit_reply_markupr+   rL   r9   r:   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`   rL   r9   r:   r;   r<   r&   rO   rP   rQ   )r`   rL   r9   r:   r;   r<   r&   )r#   rB   edit_message_mediarI   
edit_media)r+   r`   rL   r9   r:   r;   r<   r&   r.   r.   r/   ra     s0   #z CallbackQuery.edit_message_media)locationr9   r:   r;   r<   r&   latitude	longitudehorizontal_accuracyheadingproximity_alert_radiuslive_periodrc   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#   rd   re   rc   rL   r9   r:   r;   r<   r&   rf   rg   rh   ri   rO   NrP   rQ   )rd   re   rc   rL   r9   r:   r;   r<   r&   rf   rg   rh   ri   r.   )r#   rB   edit_message_live_locationrI   edit_live_location)r+   rd   re   rL   rf   rg   rh   ri   rc   r9   r:   r;   r<   r&   r.   r.   r/   rj     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#   rL   r9   r:   r;   r<   r&   rO   rP   rQ   r\   )r#   rB   stop_message_live_locationrI   stop_live_locationr_   r.   r.   r/   rl   I  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#   rn   ro   rp   rq   r9   r:   r;   r<   r&   rO   rP   )	rn   ro   rp   rq   r9   r:   r;   r<   r&   )r#   rB   set_game_scorerI   )
r+   rn   ro   rp   rq   r9   r:   r;   r<   r&   r.   r.   r/   rr     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#   rn   r9   r:   r;   r<   r&   rO   rP   )rn   r9   r:   r;   r<   r&   )r#   rB   get_game_high_scoresrI   )r+   rn   r9   r:   r;   r<   r&   r.   r.   r/   rs     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rF   r8   N)rI   ru   r+   r9   r:   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.
        pinrv   )ry   r9   r:   r;   r<   r&   N)rI   rz   )r+   ry   r9   r:   r;   r<   r&   r.   r.   r/   pin_message  s   zCallbackQuery.pin_messagec                   rt   )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.
        unpinrv   r8   N)rI   r|   rw   r.   r.   r/   unpin_message=  s   zCallbackQuery.unpin_message)allow_sending_without_replyreply_to_message_idr9   r:   r;   r<   r&   rO   protect_contentmessage_thread_idreply_parametersr   allow_paid_broadcastvideo_start_timestampsuggested_post_parametersr   r~   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|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,
                direct_messages_topic_id=update.message.direct_messages_topic.topic_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.
        copyrv   rO   rT   rK   r   rU   ry   r   r~   rL   r9   r:   r;   r<   r&   r   r   r   rV   r   r   Nr.   )rI   r   )r+   rO   rT   rK   rU   ry   rL   r   r   r   rV   r   r   r   r~   r   r9   r:   r;   r<   r&   r.   r.   r/   copy_message]  sT   -	

zCallbackQuery.copy_messageMAX_ANSWER_TEXT_LENGTH)NNNN)N)rE   )NNNNNNN)NN)0__name__
__module____qualname____doc__	__slots__strr   r   r
   r   r(   classmethodr6   r   boolr   r   floatrD   r   rI   r   r   rR   rW   r	   r[   r]   ra   intr   rj   rl   rr   tuplers   rx   r{   r}   r   r   r   CallbackQueryLimit!ANSWER_CALLBACK_QUERY_TEXT_LENGTHr   r   __annotations____classcell__r.   r.   r,   r/   r   1   sl  
 D

"	

%
	


J
	


H	


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


>



Q
	
>	


D	
:
#	
%
#

	

E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.   r/   <module>   s   ,