o
    ZzjN  ã                   @   sŠ   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„ deeeef ƒZdS )z8This module contains the ManagedBotUpdatedHandler class.é    )ÚTypeVar)ÚUpdate)ÚDEFAULT_TRUE)ÚSCTÚDVType)ÚBaseHandler)Úparse_chat_idÚparse_username)ÚCCTÚHandlerCallbackÚRTc                       sr   e Zd ZdZdZddefdddeeee	f de
e dB de
e dB d	ee f
‡ fd
d„Zdedefdd„Z‡  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                    s(   t ƒ j||d� t|ƒ| _t|ƒ| _d S )N)r   )ÚsuperÚ__init__r   r   r	   r   )r   r   r   r   r   ©Ú	__class__© új/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/ext/_handlers/managedbotupdatedhandler.pyr   F   s   
z!ManagedBotUpdatedHandler.__init__ÚupdateÚreturnc                 C   sh   t |tƒr2|jr2| js| jsdS |jjj| jv s |jjj| jv r"dS |jjj| jv p1|jjj| jv 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`

        TF)	Ú
isinstancer   Úmanaged_botr   r   ÚuserÚidÚbotr   )r   r   r   r   r   Úcheck_updateR   s   
þz%ManagedBotUpdatedHandler.check_update)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r
   r   r   ÚintÚstrr   Úboolr   Úobjectr"   Ú__classcell__r   r   r   r   r   !   s$    ûÿþ
ý
üû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   r   r   Ú<module>   s   