
    iW                         d 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 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 )z.This module contains the MessageHandler class.    )TYPE_CHECKINGAnyTypeVar)Update)DEFAULT_TRUE)DVTypefilters)BaseHandler)CCTHandlerCallback)ApplicationRTc                        e Zd ZdZdZefdddej        dz  dee	e
ef         dee         f fd	Zd
edeeeee         f         z  dz  fdZde
d
e	dddeeeef         z  dz  ddf
dZ xZS )MessageHandlera  Handler class to handle Telegram messages. They might contain text, media or status
    updates.

    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:
        filters (:class:`telegram.ext.filters.BaseFilter`): A filter inheriting from
            :class:`telegram.ext.filters.BaseFilter`. Standard filters can be found in
            :mod:`telegram.ext.filters`. Filters can be combined using bitwise
            operators (& for and, | for or, ~ for not). Passing :obj:`None` is a shortcut
            to passing :class:`telegram.ext.filters.ALL`.

            .. seealso:: :wiki:`Advanced Filters <Extensions---Advanced-Filters>`
        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`

    Attributes:
        filters (:class:`telegram.ext.filters.BaseFilter`): Only allow updates with these Filters.
            See :mod:`telegram.ext.filters` for a full list of all available filters.
        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`.

    r	   selfzMessageHandler[CCT, RT]r
   Ncallbackblockc                 x    t                                          ||           ||nt          j        | _        d S )N)r   )super__init__filters_moduleALLr
   )r   r
   r   r   	__class__s       e/Users/shanyulin/my-agent/.venv/lib/python3.11/site-packages/telegram/ext/_handlers/messagehandler.pyr   zMessageHandler.__init__N   s<     	///*GG0B 	    updatereturnc                 h    t          |t                    r| j                            |          pdS dS )zDetermines whether an update should be passed to this handler's :attr:`callback`.

        Args:
            update (:class:`telegram.Update` | :obj:`object`): Incoming update.

        Returns:
            :obj:`bool`

        FN)
isinstancer   r
   check_update)r   r   s     r   r!   zMessageHandler.check_updateY   s6     ff%% 	><,,V44==tr   contextapplicationz)Application[Any, CCT, Any, Any, Any, Any]check_resultc                 ^    t          |t                    r|                    |           dS dS )zEAdds possible output of data filters to the :class:`CallbackContext`.N)r    dictr   )r   r"   r   r#   r$   s        r   collect_additional_contextz)MessageHandler.collect_additional_contextg   s8     lD)) 	)NN<(((((	) 	)r   )__name__
__module____qualname____doc__	__slots__r   r   
BaseFilterr   r   r   r   r   boolr   objectr&   strlistr   r!   r'   __classcell__)r   s   @r   r   r   $   s%       % %N I +		
 	
'	
*T1	
 "&#r/2	
 d|		
 	
 	
 	
 	
 	
6 dT#tCy.5I.ID.P    	)	) 	) A		)
 T#v+..5	) 
	) 	) 	) 	) 	) 	) 	) 	)r   r   N)r+   typingr   r   r   telegramr   telegram._utils.defaultvaluer   telegram._utils.typesr   telegram.extr
   r   "telegram.ext._handlers.basehandlerr   telegram.ext._utils.typesr   r   r   r   r    r   r   <module>r;      s  & 5 4 . . . . . . . . . .       5 5 5 5 5 5 ( ( ( ( ( ( 2 2 2 2 2 2 : : : : : : : : : : : : : : )((((((WT]]L) L) L) L) L)[b1 L) L) L) L) L)r   