L ivdZddlmZmZddlmZddlmZddlm Z m Z ddl m Z m Z mZGddeee e fZy ) z0This module contains the ChatBoostHandler class.)FinalOptional)Update) BaseHandler) parse_chat_idparse_username)CCTRTHandlerCallbackc eZdZUdZdZdZeeed< dZ eeed< dZ eeed< ed d d fd d d e e e efdedeedeedef fd ZdedefdZxZS)ChatBoostHandlera~ Handler class to handle Telegram updates that contain a chat boost. 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. .. versionadded:: 20.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) The return value of the callback is usually ignored except for the special case of :class:`telegram.ext.ConversationHandler`. chat_boost_types (:obj:`int`, optional): Pass one of :attr:`CHAT_BOOST`, :attr:`REMOVED_CHAT_BOOST` or :attr:`ANY_CHAT_BOOST` to specify if this handler should handle only updates with :attr:`telegram.Update.chat_boost`, :attr:`telegram.Update.removed_chat_boost` or both. Defaults to :attr:`CHAT_BOOST`. chat_id (:obj:`int` | Collection[:obj:`int`], optional): Filters reactions to allow only those which happen in the specified chat ID(s). chat_username (:obj:`str` | Collection[:obj:`str`], optional): Filters reactions to allow only those which happen in the specified username(s). 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. chat_boost_types (:obj:`int`): Optional. Specifies if this handler should handle only updates with :attr:`telegram.Update.chat_boost`, :attr:`telegram.Update.removed_chat_boost` or both. block (:obj:`bool`): Determines whether the callback will run in a blocking way. ) _chat_ids_chat_usernameschat_boost_types CHAT_BOOSTrREMOVED_CHAT_BOOSTANY_CHAT_BOOSTNTselfzChatBoostHandler[CCT, RT]callbackrchat_id chat_usernameblockcvt|||||_t||_t ||_y)N)r)super__init__rrrrr)rrrrrr __class__s m/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/ext/_handlers/chatboosthandler.pyrzChatBoostHandler.__init__Vs8 /%5&w/-m<updatereturnc"t|tsy|js |jsy|j|j k(r |jsy|j|j k(r |jsyt|j|jfsy|jx}r |jnd}|r |jnd}t|jxr||jvxs%t|jxr||jvS)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` FTN) isinstancer chat_boostremoved_chat_boostrrranyrreffective_chatidusernamebool)rr!chatrrs r check_updatezChatBoostHandler.check_updatecs&&)!!V%>%>  DOO 3F>(AC t  Lmt7K7K&KH  r )__name__ __module__ __qualname____doc__ __slots__rrint__annotations__rrr rr r rstrr+robjectr- __classcell__)rs@rr r s(TI  Jc \%&c &c!"NE#J"7 !+!%'+ =) =!&#r/2 = =# =  } =  = 6 d r r N)r1typingrrtelegramr"telegram.ext._handlers.basehandlerr#telegram.ext._utils._update_parsingrrtelegram.ext._utils.typesr r r r r rr>s5&7":M>>e {63?3e r