o
    Zzj•  ã                   @   sŠ   d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZ ed	ƒZG d
d„ deeeef ƒZdS )z1This module contains the ChatMemberHandler class.é    )ÚFinalÚTypeVar)ÚUpdate)ÚDEFAULT_TRUE)ÚSCTÚDVType)ÚBaseHandler)Úparse_chat_id)ÚCCTÚHandlerCallbackÚRTc                       s¢   e Zd ZU dZdZdZee ed< 	 dZ	ee ed< 	 dZ
ee ed< 	 eed	fd
ddeeeef dedee dee d	B f
‡ fdd„Zdedefdd„Z‡  ZS )ÚChatMemberHandlera“  Handler class to handle Telegram updates that contain a chat member update.

    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.

    Examples:
        :any:`Chat Member Bot <examples.chatmemberbot>`

    .. versionadded:: 13.4

    Args:
        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`.
        chat_member_types (:obj:`int`, optional): Pass one of :attr:`MY_CHAT_MEMBER`,
            :attr:`CHAT_MEMBER` or :attr:`ANY_CHAT_MEMBER` to specify if this handler should handle
            only updates with :attr:`telegram.Update.my_chat_member`,
            :attr:`telegram.Update.chat_member` or both. Defaults to :attr:`MY_CHAT_MEMBER`.
        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`
        chat_id (:obj:`int` | Collection[:obj:`int`], optional): Filters chat member updates from
            specified chat ID(s) only.
            .. versionadded:: 21.3

    Attributes:
        callback (:term:`coroutine function`): The callback function for this handler.
        chat_member_types (:obj:`int`): Optional. Specifies if this handler should handle
            only updates with :attr:`telegram.Update.my_chat_member`,
            :attr:`telegram.Update.chat_member` or both.
        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`.

    )Ú	_chat_idsÚchat_member_typeséÿÿÿÿÚMY_CHAT_MEMBERr   ÚCHAT_MEMBERé   ÚANY_CHAT_MEMBERNÚselfzChatMemberHandler[CCT, RT]Úcallbackr   ÚblockÚchat_idc                    s$   t ƒ j||d� || _t|ƒ| _d S )N)r   )ÚsuperÚ__init__r   r	   r   )r   r   r   r   r   ©Ú	__class__© úc/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/ext/_handlers/chatmemberhandler.pyr   Z   s   zChatMemberHandler.__init__ÚupdateÚreturnc                 C   sl   t |tƒsdS |js|jsdS | jr|jr|jj| jvrdS | j| jkr&dS | j| j	kr1t
|jƒS t
|jƒ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`

        FT)Ú
isinstancer   Úmy_chat_memberÚchat_memberr   Úeffective_chatÚidr   r   r   Úbool)r   r   r   r   r   Úcheck_updatef   s   

ÿþ

zChatMemberHandler.check_update)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   ÚintÚ__annotations__r   r   r   r   r   r
   r   r   r&   r   r   Úobjectr'   Ú__classcell__r   r   r   r   r   !   s0   
 ,ûÿþýü
ûr   N)r+   Útypingr   r   Útelegramr   Útelegram._utils.defaultvaluer   Útelegram._utils.typesr   r   Ú"telegram.ext._handlers.basehandlerr   Ú#telegram.ext._utils._update_parsingr	   Útelegram.ext._utils.typesr
   r   r   r   r   r   r   r   Ú<module>   s   