
    Yi|                         S r SSK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Jr  \(       a  SSKJr   " S S	\
\\\4   5      rg
)z4This module contains the StringCommandHandler class.    )TYPE_CHECKINGAnyOptional)DEFAULT_TRUE)DVType)BaseHandler)CCTRTHandlerCallback)Applicationc            
          ^  \ rS rSrSrSr\4SSS\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$ )StringCommandHandler    a1  Handler class to handle string commands. Commands are string updates that start with
``/``. The handler will add a :obj:`list` to the
:class:`CallbackContext` named :attr:`CallbackContext.args`. It will contain a list of strings,
which is the text following the command split on single whitespace characters.

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:
    command (:obj:`str`): The command this handler should listen for.
    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:
    command (:obj:`str`): The command this handler should listen for.
    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`.

)commandselfzStringCommandHandler[CCT, RT]r   callbackblockc                 ,   > [         TU ]  X#S9  Xl        g )N)r   )super__init__r   )r   r   r   r   	__class__s       V/app/.venv/lib/python3.13/site-packages/telegram/ext/_handlers/stringcommandhandler.pyr   StringCommandHandler.__init__I   s     	/#    updatereturnc                     [        U[        5      (       aB  UR                  S5      (       a,  USS R                  S5      nUS   U R                  :X  a  USS $ g)zDetermines whether an update should be passed to this handler's :attr:`callback`.

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

Returns:
    list[:obj:`str`]: List containing the text command split on whitespace.

/   N r   )
isinstancestr
startswithsplitr   )r   r   argss      r   check_update!StringCommandHandler.check_updateR   sU     fc""v'8'8'='=!":##C(DAw$,,&ABxr   contextapplicationz)Application[Any, CCT, Any, Any, Any, Any]check_resultNc                     XAl         g)zaAdd text after the command to :attr:`CallbackContext.args` as list, split on single
whitespaces.
N)r%   )r   r(   r   r)   r*   s        r   collect_additional_context/StringCommandHandler.collect_additional_contextb   s	     $r   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r"   r   r	   r
   r   boolr   objectr   listr&   r,   __static_attributes____classcell__)r   s   @r   r   r       s    $L I +	$-$$ "#sB,/$ d|	$ $6 htCy.A  
$
$ 
$ A	
$
 tCy)
$ 

$ 
$r   r   N)r2   typingr   r   r   telegram._utils.defaultvaluer   telegram._utils.typesr   "telegram.ext._handlers.basehandlerr   telegram.ext._utils.typesr	   r
   r   telegram.extr   r"   r    r   r   <module>r@      s>   & ; / / 5 ( : > >(L$;sC|4 L$r   