
    /jN                         d Z ddl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mZ ddlmZmZ  ed	      Z G d
 deeeef         Zy)z8This module contains the ManagedBotUpdatedHandler class.    )TypeVar)Update)DEFAULT_TRUE)SCTDVType)BaseHandler)parse_chat_idparse_username)CCTHandlerCallbackRTc                   ~     e Zd ZdZdZddefdddeeee	f   de
e   dz  de
e   dz  d	ee   f
 fd
ZdedefdZ xZS )ManagedBotUpdatedHandlera  Handler class to handle
    :attr:`updated Telegram Managed Bots <telegram.Update.managed_bot>`.

    .. versionadded:: 22.8

    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)
        user_id (:obj:`int` | Collection[:obj:`int`], optional): Filters requests to allow only
            those which are from the specified user ID(s). The user ID(s) can be either the
            creator of the managed bot or the bot itself.

        username (:obj:`str` | Collection[:obj:`str`], optional): Filters requests to allow only
            those which are from the specified username(s). The username(s) can be either the
            creator of the managed bot or the bot itself.

        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:
        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`.
    )	_user_ids
_usernamesNselfz!ManagedBotUpdatedHandler[CCT, RT]callbackuser_idusernameblockc                 h    t         |   ||       t        |      | _        t	        |      | _        y )N)r   )super__init__r	   r   r
   r   )r   r   r   r   r   	__class__s        m/var/www/html/maxservice/venv/lib/python3.12/site-packages/telegram/ext/_handlers/managedbotupdatedhandler.pyr   z!ManagedBotUpdatedHandler.__init__F   s/     	/&w/(2    updatereturnc                    t        |t              r|j                  r| j                  s| j                  sy|j                  j
                  j                  | j                  v s,|j                  j                  j                  | j                  v ry|j                  j
                  j                  | j                  v xs, |j                  j                  j                  | j                  v S y)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`

        TF)	
isinstancer   managed_botr   r   useridbotr   )r   r   s     r   check_updatez%ManagedBotUpdatedHandler.check_updateR   s     ff%&*<*<>>$//""''**dnn<%%)),,>""''00DOOC F%%))22dooE r   )__name__
__module____qualname____doc__	__slots__r   r   r   r   r   r   intstrr   boolr   objectr%   __classcell__)r   s   @r   r   r   !   s    >I $($(*
31
3!&#r/2
3 SD
3 c(T/	
3
 d|
36 d r   r   N)r)   typingr   telegramr   telegram._utils.defaultvaluer   telegram._utils.typesr   r   "telegram.ext._handlers.basehandlerr   #telegram.ext._utils._update_parsingr	   r
   telegram.ext._utils.typesr   r   r   r    r   r   <module>r8      sA   & ?   5 - : M :T]G{63?; Gr   