
    Yi                         S r SSKrSSKJrJr  SSKJrJrJrJrJ	r	  SSK
Jr  SSKJr  SSKJr  SSKJrJr  \(       a  SS	KJr  \" S
5      r " S S\\\\4   5      rg)z2This module contains the StringRegexHandler class.    N)MatchPattern)TYPE_CHECKINGAnyOptionalTypeVarUnion)DEFAULT_TRUE)DVType)BaseHandler)CCTHandlerCallback)ApplicationRTc            
          ^  \ rS rSrSrSr\4SSS\\\	\   4   S\
\\\4   S\\   4U 4S	 jjjrS
\S\\\      4S jrS\S
\SSS\\\      SS4
S jrSrU =r$ )StringRegexHandler$   a  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U ]  X#S9  [        U[        5      (       a  [        R
                  " U5      nXl        g )N)r   )super__init__
isinstancestrrecompiler   )r   r   r   r   	__class__s       T/app/.venv/lib/python3.13/site-packages/telegram/ext/_handlers/stringregexhandler.pyr   StringRegexHandler.__init__M   s5     	/gs##jj)G18    updatereturnc                     [        U[        5      (       a*  [        R                  " U R                  U5      =n(       a  U$ g)zDetermines 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_updateStringRegexHandler.check_updateZ   s2     fc""$,,1O(O(OLr"   contextapplicationz)Application[Any, CCT, Any, Any, Any, Any]check_resultNc                 H    U R                   (       a  U(       a	  U/Ul        ggg)zmAdd 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_context-StringRegexHandler.collect_additional_contexth   s     <<L+nGO )<r"   )__name__
__module____qualname____firstlineno____doc__	__slots__r
   r	   r   r   r   r   r   r   boolr   objectr   r   r'   r.   __static_attributes____classcell__)r   s   @r    r   r   $   s    $L I +	9+9sGCL()9 "#sB,/9 d|	9 96 huSz.B -- - A	-
 uSz*- 
- -r"   r   )r4   r   r   r   typingr   r   r   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>rA      sJ   & 9 	  ? ? 5 ( : :(T]O-S#r\2 O-r"   