
    'i                         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eeeef         Zy)z1This module contains the ChatMemberHandler class.    )FinalTypeVar)Update)DEFAULT_TRUE)SCTDVType)BaseHandler)parse_chat_id)CCTHandlerCallbackRTc                        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	z  f
 fdZdedefdZ x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                 V    t         |   ||       || _        t        |      | _        y )N)r   )super__init__r   r
   r   )r   r   r   r   r   	__class__s        r/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/telegram/ext/_handlers/chatmemberhandler.pyr   zChatMemberHandler.__init__Z   s+     	/->&w/    updatereturnc                    t        |t              sy|j                  s|j                  sy| j                  r/|j
                  r#|j
                  j                  | j                  vry| j                  | j                  k(  ry| j                  | j                  k(  rt        |j                        S t        |j                        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`

        FT)
isinstancer   my_chat_memberchat_memberr   effective_chatidr   r   r   bool)r   r!   s     r   check_updatezChatMemberHandler.check_updatef   s     &&)%%););NN%%%%((>!!T%9%99!!T%5%55**++F))**r    )__name__
__module____qualname____doc__	__slots__r   r   int__annotations__r   r   r   r   r   r   r   r   r)   r   r   objectr*   __classcell__)r   s   @r   r   r   !   s    *XI "$NE#J#_Ks\"#OU3Z#0 "0*#'
0*
0!&#r/2
0 
0 d|	
0
 SD
0+6 +d +r    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   <module>r<      sA   & 8 !  5 - : = :T]]+FCO4 ]+r    