§
    ®eîil  ã                   ó�   — d Z ddl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mZ erddlmZ  G d„ d	e	eeef         ¦  «        Zd
S )z4This module contains the StringCommandHandler class.é    )ÚTYPE_CHECKINGÚAny)ÚDEFAULT_TRUE)ÚDVType)ÚBaseHandler)ÚCCTÚRTÚHandlerCallback)ÚApplicationc            
       óª   ‡ — e Zd ZdZdZefddde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 )ÚStringCommandHandlera¡  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          ¦   «                              ||¬¦  «         || _        d S )N)r   )ÚsuperÚ__init__r   )r   r   r   r   Ú	__class__s       €úo/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/ext/_handlers/stringcommandhandler.pyr   zStringCommandHandler.__init__I   s-   ø€ õ 	‰Œ×Ò˜¨ÐÑ/Ô/Ð/Ø#ˆŒˆˆó    ÚupdateÚreturnNc                 óÊ   — t          |t          ¦  «        rM|                     d¦  «        r8|dd…                              d¦  «        }|d         | j        k    r
|dd…         S dS )a	  Determines 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_updatez!StringCommandHandler.check_updateR   si   € õ �f�cÑ"Ô"ð 	  v×'8Ò'8¸Ñ'=Ô'=ð 	 Ø˜!˜"˜"”:×#Ò# CÑ(Ô(ˆDØ�AŒw˜$œ,Ò&Ð&Ø˜A˜B˜B”x�Øˆtr   ÚcontextÚapplicationz)Application[Any, CCT, Any, Any, Any, Any]Úcheck_resultc                 ó   — ||_         dS )zqAdd 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_contextz/StringCommandHandler.collect_additional_contextb   s   € ð $ˆŒˆˆr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r
   r   r	   r   Úboolr   ÚobjectÚlistr#   r(   Ú__classcell__)r   s   @r   r   r       s  ø€ € € € € ð$ð $ðL €Ið +ð	$ð $Ø-ð$àð$ð " # s¨B ,Ô/ð$ð �dŒ|ð	$ð $ð $ð $ð $ð $ð 6ð ¨d°3¬i¸$Ñ.>ð ð ð ð ð 
$àð
$ð ð
$ð Að	
$ð
 ˜3”i $Ñ&ð
$ð 
ð
$ð 
$ð 
$ð 
$ð 
$ð 
$ð 
$ð 
$r   r   N)r,   Útypingr   r   Útelegram._utils.defaultvaluer   Útelegram._utils.typesr   Ú"telegram.ext._handlers.basehandlerr   Útelegram.ext._utils.typesr   r	   r
   Útelegram.extr   r   r   © r   r   ú<module>r9      sÜ   ðð& ;Ð :à %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø (Ð (Ð (Ð (Ð (Ð (Ø :Ð :Ð :Ð :Ð :Ð :Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >àð )Ø(Ð(Ð(Ð(Ð(Ð(ðL$ð L$ð L$ð L$ð L$˜; s¨C° |Ô4ñ L$ô L$ð L$ð L$ð L$r   