§
    ®eîi™  ã                   óÎ   — d Z ddlZddlmZ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 dd	lmZmZ erdd
lmZ  ed¦  «        Z G d„ dee
eef         ¦  «        ZdS )z2This module contains the InlineQueryHandler class.é    N)ÚMatchÚPattern)ÚTYPE_CHECKINGÚAnyÚTypeVarÚcast)ÚUpdate)ÚDEFAULT_TRUE)ÚDVType)ÚBaseHandler)ÚCCTÚHandlerCallback)ÚApplicationÚRTc                   óè   ‡ — e Zd ZdZdZdedfdddeeee	f         de
ee
         z  dz  dee         d	ee
         dz  f
ˆ fd
„Zdedeee
         z  dz  fd„Zdededddeee
         z  dz  ddf
d„Zˆ xZS )ÚInlineQueryHandlera

  
    BaseHandler class to handle Telegram updates that contain a
    :attr:`telegram.Update.inline_query`.
    Optionally based on a regex. Read the documentation of the :mod:`re` module for more
    information.

    Warning:
        * When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
          attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info.
        * :attr:`telegram.InlineQuery.chat_type` will not be set for inline queries from secret
          chats and may not be set for inline queries coming from third-party clients. These
          updates won't be handled, if :attr:`chat_types` is passed.

    Examples:
        :any:`Inline Bot <examples.inlinebot>`


    Args:
        callback (:term:`coroutine function`): The callback function for this handler. Will be
            called when :meth:`check_update` has determined that an update should be processed by
            this handler. Callback signature::

                async def callback(update: Update, context: CallbackContext)

            The return value of the callback is usually ignored except for the special case of
            :class:`telegram.ext.ConversationHandler`.
        pattern (:obj:`str` | :func:`re.Pattern <re.compile>`, optional): Regex pattern.
            If not :obj:`None`, :func:`re.match` is used on :attr:`telegram.InlineQuery.query`
            to determine if an update should be handled by this handler.
        block (:obj:`bool`, optional): Determines whether the return value of the callback should
            be awaited before processing the next handler in
            :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.

            .. seealso:: :wiki:`Concurrency`
        chat_types (list[:obj:`str`], optional): List of allowed chat types. If passed, will only
            handle inline queries with the appropriate :attr:`telegram.InlineQuery.chat_type`.

            .. versionadded:: 13.5
    Attributes:
        callback (:term:`coroutine function`): The callback function for this handler.
        pattern (:obj:`str` | :func:`re.Pattern <re.compile>`): Optional. Regex pattern to test
            :attr:`telegram.InlineQuery.query` against.
        chat_types (list[:obj:`str`]): Optional. List of allowed chat types.

            .. versionadded:: 13.5
        block (:obj:`bool`): Determines whether the return value of the callback should be
            awaited before processing the next handler in
            :meth:`telegram.ext.Application.process_update`.

    )Ú
chat_typesÚpatternNÚselfzInlineQueryHandler[CCT, RT]Úcallbackr   Úblockr   c                 ó¼   •— t          ¦   «                              ||¬¦  «         t          |t          ¦  «        rt	          j        |¦  «        }|| _        || _        d S )N)r   )ÚsuperÚ__init__Ú
isinstanceÚstrÚreÚcompiler   r   )r   r   r   r   r   Ú	__class__s        €úm/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/ext/_handlers/inlinequeryhandler.pyr   zInlineQueryHandler.__init__[   sU   ø€ õ 	‰Œ×Ò˜¨ÐÑ/Ô/Ð/å�g�sÑ#Ô#ð 	*Ý”j Ñ)Ô)ˆGà29ˆŒØ,6ˆŒˆˆó    ÚupdateÚreturnc                 óæ   — t          |t          ¦  «        r[|j        rT| j        �|j        j        | j        vrdS | j        r(t          j        | j        |j        j        ¦  «        x}r|S | j        sdS dS )zÿ
        Determines whether an update should be passed to this handler's :attr:`callback`.

        Args:
            update (:class:`telegram.Update` | :obj:`object`): Incoming update.

        Returns:
            :obj:`bool` | :obj:`re.match`

        NFT)	r   r	   Úinline_queryr   Ú	chat_typer   r   ÚmatchÚquery)r   r"   r'   s      r    Úcheck_updatezInlineQueryHandler.check_updatej   sƒ   € õ �f�fÑ%Ô%ð 	¨&Ô*=ð 	Ø”Ð+ØÔ#Ô-°T´_ÐDÐDà�uØŒ|ð ­"¬(°4´<ÀÔATÔAZÑ*[Ô*[Ð![ ð Ø�Ø”<ð Ø�tØˆtr!   ÚcontextÚapplicationz)Application[Any, CCT, Any, Any, Any, Any]Úcheck_resultc                 óH   — | j         rt          d|¦  «        }|g|_        dS dS )z�Add the result of ``re.match(pattern, update.inline_query.query)`` to
        :attr:`CallbackContext.matches` as list with one element.
        r   N)r   r   Úmatches)r   r*   r"   r+   r,   s        r    Úcollect_additional_contextz-InlineQueryHandler.collect_additional_context€   s4   € ð Œ<ð 	-Ý ¨Ñ6Ô6ˆLØ+˜nˆGŒOˆOˆOð	-ð 	-r!   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r
   r   r	   r   r   r   r   r   ÚboolÚlistr   Úobjectr   r)   r/   Ú__classcell__)r   s   @r    r   r   %   s6  ø€ € € € € ð1ð 1ðf *€Ið
 .2Ø*Ø'+ð7ð 7Ø+ð7à! &¨#¨r /Ô2ð7ð �w˜s”|Ñ# dÑ*ð7ð �dŒ|ð	7ð
 ˜”I Ñ$ð7ð 7ð 7ð 7ð 7ð 7ð 6ð ¨d°U¸3´ZÑ.?À$Ñ.Fð ð ð ð ð,-àð-ð ð-ð Að	-ð
 ˜U 3œZÑ'¨$Ñ.ð-ð 
ð-ð -ð -ð -ð -ð -ð -ð -r!   r   )r3   r   r   r   Útypingr   r   r   r   Útelegramr	   Útelegram._utils.defaultvaluer
   Útelegram._utils.typesr   Ú"telegram.ext._handlers.basehandlerr   Útelegram.ext._utils.typesr   r   Útelegram.extr   r   r   © r!   r    ú<module>rA      s"  ðð& 9Ð 8à 	€	€	€	Ø Ð Ð Ð Ð Ð Ð Ð Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à Ð Ð Ð Ð Ð Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø (Ð (Ð (Ð (Ð (Ð (Ø :Ð :Ð :Ð :Ð :Ð :Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :àð )Ø(Ð(Ð(Ð(Ð(Ð(à€WˆT�]„]€ðg-ð g-ð g-ð g-ð g-˜ V¨S°" _Ô5ñ g-ô g-ð g-ð g-ð g-r!   