§
    ®eîiÃ  ã                   ó¾   — d Z ddlZddlmZmZ ddl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 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 StringRegexHandler class.é    N)ÚMatchÚPattern)ÚTYPE_CHECKINGÚAnyÚTypeVar)ÚDEFAULT_TRUE)ÚDVType)ÚBaseHandler)ÚCCTÚHandlerCallback)ÚApplicationÚRTc            
       ó¼   ‡ — e Zd ZdZdZefdddeee         z  deee	e
f         dee         fˆ fd„Zd	ed
ee         dz  fd„Zde	d	edddee         dz  d
df
d„Zˆ xZS )ÚStringRegexHandlera|  Handler class to handle string updates based on a regex which checks the update content.

    Read the documentation of the :mod:`re` module for more information. The :func:`re.match`
    function is used to determine if an update should be handled by this handler.

    Note:
        This handler is not used to handle Telegram :class:`telegram.Update`, but strings manually
        put in the queue. For example to send messages with the bot using command line or API.

    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:
        pattern (:obj:`str` | :func:`re.Pattern <re.compile>`): The regex pattern.
        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: str, 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`

    Attributes:
        pattern (:obj:`str` | :func:`re.Pattern <re.compile>`): The regex pattern.
        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ÚselfzStringRegexHandler[CCT, RT]r   ÚcallbackÚblockc                 ó®   •— t          ¦   «                              ||¬¦  «         t          |t          ¦  «        rt	          j        |¦  «        }|| _        d S )N)r   )ÚsuperÚ__init__Ú
isinstanceÚstrÚreÚcompiler   )r   r   r   r   Ú	__class__s       €úm/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/ext/_handlers/stringregexhandler.pyr   zStringRegexHandler.__init__M   sN   ø€ õ 	‰Œ×Ò˜¨ÐÑ/Ô/Ð/å�g�sÑ#Ô#ð 	*Ý”j Ñ)Ô)ˆGà+2ˆŒˆˆó    ÚupdateÚreturnNc                 ól   — t          |t          ¦  «        rt          j        | j        |¦  «        x}r|S dS )zßDetermines whether an update should be passed to this handler's :attr:`callback`.

        Args:
            update (:obj:`object`): The incoming update.

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

        N)r   r   r   Úmatchr   )r   r   r"   s      r   Úcheck_updatezStringRegexHandler.check_updateZ   s:   € õ �f�cÑ"Ô"ð 	µ´¸$¼,ÈÑ1OÔ1OÐ(O¨ð 	ØˆLØˆtr   ÚcontextÚapplicationz)Application[Any, CCT, Any, Any, Any, Any]Úcheck_resultc                 ó0   — | j         r|r|g|_        dS dS dS )z}Add the result of ``re.match(pattern, update)`` to :attr:`CallbackContext.matches` as
        list with one element.
        N)r   Úmatches)r   r$   r   r%   r&   s        r   Úcollect_additional_contextz-StringRegexHandler.collect_additional_contexth   s6   € ð Œ<ð 	-˜Lð 	-Ø+˜nˆGŒOˆOˆOð	-ð 	-ð 	-ð 	-r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   r   r   r	   Úboolr   Úobjectr   r#   r)   Ú__classcell__)r   s   @r   r   r   $   s  ø€ € € € € ð$ð $ðL €Ið +ð	3ð 3Ø+ð3à�w˜s”|Ñ#ð3ð " # s¨B ,Ô/ð3ð �dŒ|ð	3ð 3ð 3ð 3ð 3ð 3ð 6ð ¨e°C¬j¸4Ñ.?ð ð ð ð ð-àð-ð ð-ð Að	-ð
 ˜C”j 4Ñ'ð-ð 
ð-ð -ð -ð -ð -ð -ð -ð -r   r   )r-   r   r   r   Útypingr   r   r   Útelegram._utils.defaultvaluer   Útelegram._utils.typesr	   Ú"telegram.ext._handlers.basehandlerr
   Útelegram.ext._utils.typesr   r   Útelegram.extr   r   r   r   © r   r   ú<module>r9      s
  ðð& 9Ð 8à 	€	€	€	Ø Ð Ð Ð Ð Ð Ð Ð Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .à 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø (Ð (Ð (Ð (Ð (Ð (Ø :Ð :Ð :Ð :Ð :Ð :Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :àð )Ø(Ð(Ð(Ð(Ð(Ð(à€WˆT�]„]€ðO-ð O-ð O-ð O-ð O-˜ S¨#¨r \Ô2ñ O-ô O-ð O-ð O-ð O-r   