§
    ­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d
¦  «        ZerddlmZ  G d„ dee
eef         ¦  «        ZdS )z9This module contains the ChosenInlineResultHandler class.é    N)ÚMatchÚPattern)ÚTYPE_CHECKINGÚAnyÚTypeVarÚcast)ÚUpdate)ÚDEFAULT_TRUE)ÚDVType)ÚBaseHandler)ÚCCTÚHandlerCallbackÚRT)ÚApplicationc                   ó¾   ‡ — e Zd ZdZdZedfdddeeee	f         de
e         deee         z  dz  fˆ fd	„Zd
edeez  dz  fd„Zded
edddeee         z  ddf
d„Zˆ xZS )ÚChosenInlineResultHandlera©  Handler class to handle Telegram updates that contain
    :attr:`telegram.Update.chosen_inline_result`.

    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.

    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`.
        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`
        pattern (:obj:`str` | :func:`re.Pattern <re.compile>`, optional): Regex pattern. If not
            :obj:`None`, :func:`re.match`
            is used on :attr:`telegram.ChosenInlineResult.result_id` to determine if an update
            should be handled by this handler. This is accessible in the callback as
            :attr:`telegram.ext.CallbackContext.matches`.

            .. versionadded:: 13.6
    Attributes:
        callback (:term:`coroutine function`): The callback function for this handler.
        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`.
        pattern (`Pattern`): Optional. Regex pattern to test
            :attr:`telegram.ChosenInlineResult.result_id` against.

            .. versionadded:: 13.6

    )ÚpatternNÚselfz"ChosenInlineResultHandler[CCT, RT]ÚcallbackÚblockr   c                 ó®   •— t          ¦   «                              ||¬¦  «         t          |t          ¦  «        rt	          j        |¦  «        }|| _        d S )N)r   )ÚsuperÚ__init__Ú
isinstanceÚstrÚreÚcompiler   )r   r   r   r   Ú	__class__s       €út/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/ext/_handlers/choseninlineresulthandler.pyr   z"ChosenInlineResultHandler.__init__P   sN   ø€ õ 	‰Œ×Ò˜¨ÐÑ/Ô/Ð/å�g�sÑ#Ô#ð 	*Ý”j Ñ)Ô)ˆGà29ˆŒˆˆó    ÚupdateÚreturnc                 ó¢   — t          |t          ¦  «        r9|j        r2| j        r)t	          j        | j        |j        j        ¦  «        x}r|S n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`

        TN)r   r	   Úchosen_inline_resultr   r   ÚmatchÚ	result_id)r   r!   r%   s      r   Úcheck_updatez&ChosenInlineResultHandler.check_update]   sa   € õ �f�fÑ%Ô%ð 	¨&Ô*Eð 	ØŒ|ð ÝœH T¤\°6Ô3NÔ3XÑYÔYÐY�5ð !Ø �Lð!ð �tØˆtr    ÚcontextÚapplicationz)Application[Any, CCT, Any, Any, Any, Any]Úcheck_resultc                 óH   — | j         rt          d|¦  «        }|g|_        dS dS )zuThis function adds the matched regex pattern result to
        :attr:`telegram.ext.CallbackContext.matches`.
        r   N)r   r   Úmatches)r   r(   r!   r)   r*   s        r   Úcollect_additional_contextz4ChosenInlineResultHandler.collect_additional_contexto   s4   € ð Œ<ð 	-Ý ¨Ñ6Ô6ˆLØ+˜nˆGŒOˆOˆOð	-ð 	-r    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r
   r   r	   r   r   r   Úboolr   r   r   Úobjectr'   r   r-   Ú__classcell__)r   s   @r   r   r   %   s  ø€ € € € € ð&ð &ðP €Ið
 +Ø-1ð	:ð :Ø2ð:à! &¨#¨r /Ô2ð:ð �dŒ|ð:ð �w˜s”|Ñ# dÑ*ð	:ð :ð :ð :ð :ð :ð 6ð ¨d°V©m¸dÑ.Bð ð ð ð ð$-àð-ð ð-ð Að	-ð
 ˜U 3œZÑ'ð-ð 
ð-ð -ð -ð -ð -ð -ð -ð -r    r   )r1   r   r   r   Útypingr   r   r   r   Útelegramr	   Útelegram._utils.defaultvaluer
   Útelegram._utils.typesr   Ú"telegram.ext._handlers.basehandlerr   Útelegram.ext._utils.typesr   r   r   Útelegram.extr   r   © r    r   ú<module>r>      s#  ðð& @Ð ?à 	€	€	€	Ø Ð Ð Ð Ð Ð Ð Ð Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4à Ð Ð Ð Ð Ð Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø (Ð (Ð (Ð (Ð (Ð (Ø :Ð :Ð :Ð :Ð :Ð :Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :à€WˆT�]„]€àð )Ø(Ð(Ð(Ð(Ð(Ð(ðV-ð V-ð V-ð V-ð V- ¨F°C¸¨OÔ <ñ V-ô V-ð V-ð V-ð V-r    