o
    ZzjW  ã                   @   sš   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„ 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                       s¢   e Zd ZdZdZefdddejdB dee	e
ef dee f‡ fd	d
„Zdedeeeee f B dB fdd„Zde
de	dddeeeef B dB ddf
dd„Z‡  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                    s.   t ƒ j||d� |d ur|| _d S tj| _d S )N)r   )ÚsuperÚ__init__Úfilters_moduleÚALLr	   )r   r	   r   r   ©Ú	__class__© ú`/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/ext/_handlers/messagehandler.pyr   N   s
   
ÿÿzMessageHandler.__init__ÚupdateÚreturnc                 C   s   t |tƒr| j |¡pdS dS )zäDetermines 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   r   r   r   r   Y   s   

zMessageHandler.check_updateÚcontextÚapplicationz)Application[Any, CCT, Any, Any, Any, Any]Úcheck_resultc                 C   s   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!   r   r   r   Úcollect_additional_contextg   s   
ÿz)MessageHandler.collect_additional_context)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   Ú
BaseFilterr   r   r   r   r   Úboolr   Úobjectr"   ÚstrÚlistr   r   r#   Ú__classcell__r   r   r   r   r   $   s2    'üÿþýü&þýüûú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   r   r   Ú<module>   s   