§
    ®eîiÙ  ã                   óœ   — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZmZ ddlmZmZ  G d	„ d
eeeef         ¦  «        ZdS )z6This module contains the MessageReactionHandler class.é    )ÚFinal)ÚUpdate)ÚDEFAULT_TRUE)ÚRTÚSCTÚDVType)ÚBaseHandler)Úparse_chat_idÚparse_username)ÚCCTÚHandlerCallbackc                   ó"  ‡ — 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<   	 d	d	d	d	e
efd
ddeeeef         dee         d	z  dee         d	z  dee         d	z  dee         d	z  dedee         fˆ fd„Zdedefd„Zˆ xZS )ÚMessageReactionHandleraµ  Handler class to handle Telegram updates that contain a message reaction.

    Note:
        The following rules apply to both ``username`` and the ``chat_id`` param groups,
        respectively:

         * If none of them are passed, the handler does not filter the update for that specific
            attribute.
         * If a chat ID **or** a username is passed, the updates will be filtered with that
            specific attribute.
         * If a chat ID **and** a username are passed, an update containing **any** of them will be
            filtered.
         * :attr:`telegram.MessageReactionUpdated.actor_chat` is *not* considered for
           :paramref:`user_id` and :paramref:`user_username` filtering.

    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`.
        message_reaction_types (:obj:`int`, optional): Pass one of
            :attr:`MESSAGE_REACTION_UPDATED`, :attr:`MESSAGE_REACTION_COUNT_UPDATED` or
            :attr:`MESSAGE_REACTION` to specify if this handler should handle only updates with
            :attr:`telegram.Update.message_reaction`,
            :attr:`telegram.Update.message_reaction_count` or both. Defaults to
            :attr:`MESSAGE_REACTION`.
        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).
        user_id (:obj:`int` | Collection[:obj:`int`], optional): Filters reactions to allow
            only those which are set by the specified chat ID(s) (this can be the chat itself in
            the case of anonymous users, see the
            :paramref:`telegram.MessageReactionUpdated.actor_chat`).
        user_username (:obj:`str` | Collection[:obj:`str`], optional): Filters reactions to allow
            only those which are set by the specified username(s) (this can be the chat itself in
            the case of anonymous users, see the
            :paramref:`telegram.MessageReactionUpdated.actor_chat`).
        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.
        message_reaction_types (:obj:`int`): Optional. Specifies if this handler should handle only
            updates with :attr:`telegram.Update.message_reaction`,
            :attr:`telegram.Update.message_reaction_count` or both.
        block (:obj:`bool`): Determines whether the callback will run in a blocking way.

    )Ú	_chat_idsÚ_chat_usernamesÚ	_user_idsÚ_user_usernamesÚmessage_reaction_typeséÿÿÿÿÚMESSAGE_REACTION_UPDATEDr   ÚMESSAGE_REACTION_COUNT_UPDATEDé   ÚMESSAGE_REACTIONNÚselfzMessageReactionHandler[CCT, RT]ÚcallbackÚchat_idÚchat_usernameÚuser_idÚuser_usernamer   Úblockc                 óB  •— t          ¦   «                              ||¬¦  «         || _        t          |¦  «        | _        t          |¦  «        | _        |s|r|| j        | j        fv rt          d¦  «        ‚t          |¦  «        | _
        t          |¦  «        | _        d S )N)r    zwYou can not filter for users and include anonymous reactions. Set `message_reaction_types` to MESSAGE_REACTION_UPDATED.)ÚsuperÚ__init__r   r
   r   r   r   r   r   Ú
ValueErrorr   r   )	r   r   r   r   r   r   r   r    Ú	__class__s	           €úq/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/ext/_handlers/messagereactionhandler.pyr#   zMessageReactionHandler.__init__p   s¸   ø€ õ 	‰Œ×Ò˜¨ÐÑ/Ô/Ð/Ø+AˆÔ#å& wÑ/Ô/ˆŒÝ-¨mÑ<Ô<ˆÔØð 	�}ð 	Ð*@ØÔ!ØÔ/ðE
ð +
ð +
õ ðHñô ð õ ' wÑ/Ô/ˆŒÝ-¨mÑ<Ô<ˆÔÐÐó    ÚupdateÚreturnc                 ób  — t          |t          ¦  «        sdS |j        s	|j        sdS | j        | j        k    r	|j        rdS | j        | j        k    r	|j        rdS t          | j        | j	        | j
        | j        f¦  «        sdS |j        x}r|j        nd}|r|j        nd}|j        x}r|j        nd}|r|j        nd}t!          | j        o|| j        v ¦  «        pVt!          | j	        o|| j	        v ¦  «        p9t!          | j
        o|| j
        v ¦  «        pt!          | j        o|| j        v ¦  «        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`

        FTN)Ú
isinstancer   Úmessage_reactionÚmessage_reaction_countr   r   r   Úanyr   r   r   r   Úeffective_chatÚidÚusernameÚeffective_userÚbool)r   r(   Úchatr   r   Úuserr   r   s           r&   Úcheck_updatez#MessageReactionHandler.check_updateŠ   s~  € õ ˜&¥&Ñ)Ô)ð 	Ø�5àÔ'ð 	¨6Ô+Hð 	Ø�5ð Ô'¨4Ô+HÒHÐHØÔ-ð Ið �5ð Ô'¨4Ô+NÒNÐNØÔ'ð Oð �5å�D”N DÔ$8¸$¼.È$ÔJ^Ð_Ñ`Ô`ð 	Ø�4ð '-Ô&;Ð;˜dÐF�$”'�'À$ˆØ)-Ð7˜œ˜°4ˆØ&,Ô&;Ð;˜dÐF�$”'�'À$ˆØ)-Ð7˜œ˜°4ˆõ �”Ð? W°´Ð%>Ñ@Ô@ð VÝ�DÔ(ÐT¨m¸tÔ?SÐ.SÑUÔUðVå�D”NÐB¨°4´>Ð(AÑCÔCðVõ �DÔ(ÐT¨m¸tÔ?SÐ.SÑUÔUð		
r'   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   ÚintÚ__annotations__r   r   r   r   r   r   r   r   Ústrr   r3   r#   Úobjectr6   Ú__classcell__)r%   s   @r&   r   r      sU  ø€ € € € € € ð=ð =ð~€Ið ,.Ð˜e CœjÐ-Ð-Ñ-ØaØ12Ð" E¨#¤JÐ2Ð2Ñ2ð7à#$Ð�e˜C”jÐ$Ð$Ñ$ð;ð $(Ø)-Ø#'Ø)-Ø&6Ø*ð=ð =Ø/ð=à! &¨#¨r /Ô2ð=ð �S”˜D‘ð=ð ˜3”x $‘ð	=ð
 �S”˜D‘ð=ð ˜3”x $‘ð=ð !$ð=ð �dŒ|ð=ð =ð =ð =ð =ð =ð4*
 6ð *
¨dð *
ð *
ð *
ð *
ð *
ð *
ð *
ð *
r'   r   N)r:   Útypingr   Útelegramr   Útelegram._utils.defaultvaluer   Útelegram._utils.typesr   r   r   Ú"telegram.ext._handlers.basehandlerr	   Ú#telegram.ext._utils._update_parsingr
   r   Útelegram.ext._utils.typesr   r   r   © r'   r&   ú<module>rI      sì   ðð& =Ð <à Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø :Ð :Ð :Ð :Ð :Ð :Ø MÐ MÐ MÐ MÐ MÐ MÐ MÐ MØ :Ð :Ð :Ð :Ð :Ð :Ð :Ð :ðU
ð U
ð U
ð U
ð U
˜[¨°°b¨Ô9ñ U
ô U
ð U
ð U
ð U
r'   