o
    -˜Žj$  ã                   @   s:   d dl mZmZ d dlZd dlmZmZ G dd„ dƒZdS )é    )ÚUnionÚListN)ÚrawÚtypesc                   @   s`   e Zd Z					ddddeeef dededeeeeeeef  f d	ed
eddfdd„ZdS )ÚSendReactionNFÚselfzpyrogram.ClientÚchat_idÚ
message_idÚstory_idÚemojiÚbigÚadd_to_recentÚreturnztypes.MessageReactionsc              	   Ã   s:  �t |tƒr|rdd„ |D ƒnd}nt |tƒr tjj|d�g}n|r*tjj|d�gnd}|durs|  tjj	j
|  |¡I dH ||||d�¡I dH }dd„ |jD ƒ}	d	d„ |jD ƒ}
|jD ]}t |tjjƒrptj | |j|	|
¡  S q[dS |dur™|  tjjj
|  |¡I dH ||rŽtjj|d�nd|d
�¡I dH  dS tdƒ‚)ui	  Use this method to send reactions on a message/stories.
        Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel.
        Bots can't use paid reactions.
        
        You must use exactly one of ``message_id`` OR ``story_id``.
        
            If you specify, ``message_id``
                .. include:: /_includes/usable-by/users-bots.rst
                
            If you specify, ``story_id``
                .. include:: /_includes/usable-by/users.rst

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                You can also use chat public link in form of *t.me/<username>* (str).

            message_id (``int``, *optional*):
                Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.

            story_id (``int``, *optional*):
                Identifier of the story.

            emoji (``int`` | ``str`` | List of ``int`` | ``str``, *optional*):
                Reaction emoji.
                Pass None as emoji (default) to retract the reaction.
                Pass list of int or str to react multiple emojis.

            big (``bool``, *optional*):
                Pass True to set the reaction with a big animation.
                For message reactions only.
                Defaults to False.
                
            add_to_recent (``bool``, *optional*):
                Pass True if the reaction should appear in the recently used reactions.
                This option is applicable only for users.

        Returns:
            :obj:`~pyrogram.types.MessageReactions`: On success, True is returned.

        Example:
            .. code-block:: python

                # Send a reaction
                await app.send_reaction(chat_id, message_id=message_id, emoji="ðŸ”¥")
                await app.send_reaction(chat_id, story_id=story_id, emoji="ðŸ”¥")

                # Send a multiple reactions
                await app.send_reaction(chat_id, message_id=message_id, emoji=["ðŸ”¥", "â�¤ï¸�"])

                # Retract a reaction
                await app.send_reaction(chat_id, message_id=message_id)
                await app.send_reaction(chat_id, story_id=story_id)
        c                 S   s2   g | ]}t |tƒrtjj|d �ntjj|d�‘qS )©Údocument_id©Úemoticon)Ú
isinstanceÚintr   r   ÚReactionCustomEmojiÚReactionEmoji©Ú.0Úi© r   úd/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/messages/send_reaction.pyÚ
<listcomp>[   s    þÿýz.SendReaction.send_reaction.<locals>.<listcomp>Nr   r   )ÚpeerÚmsg_idÚreactionr   r   c                 S   ó   i | ]}|j |“qS r   ©Úidr   r   r   r   Ú
<dictcomp>p   ó    z.SendReaction.send_reaction.<locals>.<dictcomp>c                 S   r    r   r!   r   r   r   r   r#   q   r$   )r   r
   r   r   Tz#You need to pass one of message_id!)r   Úlistr   r   r   r   r   ÚinvokeÚ	functionsÚmessagesr   Úresolve_peerÚusersÚchatsÚupdatesÚUpdateMessageReactionsÚMessageReactionsÚ_parseÚ	reactionsÚstoriesÚ
ValueError)r   r   r	   r
   r   r   r   r   Úrr*   r+   r   r   r   r   Úsend_reaction   sN   €
?ûüû
û
ÿ	
ÿÿü
ÿzSendReaction.send_reaction)NNNFF)	Ú__name__Ú
__module__Ú__qualname__r   r   Ústrr   Úboolr4   r   r   r   r   r      s.    ùÿ
þýüûúùør   )Útypingr   r   Úpyrogramr   r   r   r   r   r   r   Ú<module>   s   