
    Yi                         S r SSKJrJr  SSKJr  SSKJr  SSKJ	r	J
r
Jr  SSKJr  SSKJrJr  SSKJrJr   " S	 S
\\\\	4   5      rg)z6This module contains the MessageReactionHandler class.    )FinalOptional)Update)DEFAULT_TRUE)RTSCTDVType)BaseHandler)parse_chat_idparse_username)CCTHandlerCallbackc                      ^  \ rS rSr% SrSrSr\\   \	S'    Sr
\\   \	S'    Sr\\   \	S	'    S
S
S
S
\\4SSS\\\\4   S\\\      S\\\      S\\\      S\\\      S\S\\   4U 4S jjjrS\S\4S jrSrU =r$ )MessageReactionHandler   a  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                   > [         TU ]  XS9  X`l        [        U5      U l        [        U5      U l        U(       d  U(       a'  UU R                  U R                  4;   a  [        S5      e[        U5      U l
        [        U5      U l        g )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	           X/app/.venv/lib/python3.13/site-packages/telegram/ext/_handlers/messagereactionhandler.pyr%   MessageReactionHandler.__init__p   s     	/+A#&w/-m<}*@!!//E
 +
 H  'w/-m<    updatereturnc                    [        U[        5      (       d  gUR                  (       d  UR                  (       d  gU R                  U R
                  :X  a  UR                  (       a  gU R                  U R                  :X  a  UR                  (       a  g[        U R                  U R                  U R                  U R                  45      (       d  gUR                  =n(       a  UR                  OSnU(       a  UR                  OSnUR                  =n(       a  UR                  OSnU(       a  UR                  OSn[!        U R                  =(       a    X0R                  ;   5      =(       d    [!        U R                  =(       a    X@R                  ;   5      =(       d[    [!        U R                  =(       a    X`R                  ;   5      =(       d*    [!        U R                  =(       a    XpR                  ;   5      $ )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   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_update#MessageReactionHandler.check_update   sl    &&))''6+H+H ''4+H+HH-- ''4+N+NN''DNND$8$8$..$J^J^_`` '-&;&;;d;$''$)-4&,&;&;;d;$''$)-4 ?W%>@ VD((Tm?S?S.SUVDNNB>>(ACV D((Tm?S?S.SU		
r*   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   int__annotations__r   r   r   r   r   r   r   r   r   strr	   r6   r%   objectr9   __static_attributes____classcell__)r'   s   @r(   r   r      s   =~I ,.eCj-a12"E#J27#$eCj$; '+,0&*,0&6*=/=!&#r/2= #c(#=  C)	=
 #c(#=  C)= !$= d|= =4*
6 *
d *
 *
r*   r   N)r?   typingr   r   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>rO      s;   & = "  5 1 1 : M :U
[b9 U
r*   