o
    Zzj  ã                   @   s¼   d Z ddl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 dd	lmZmZmZ dd
lmZmZ ddlmZ erLddlmZ G dd„ deƒZG dd„ deƒZdS )zQThis module contains an object that represents a Telegram MessageReaction Update.é    N)ÚSequence)ÚTYPE_CHECKING)ÚChat)ÚReactionCountÚReactionType)ÚTelegramObject)ÚUser)Úde_json_optionalÚde_list_optionalÚparse_sequence_arg)Úextract_tzinfo_from_defaultsÚfrom_timestamp)ÚJSONDict)ÚBotc                       sj   e Zd ZdZdZddœdededejde	e
 d	edB f
‡ fd
d„Zeddedddd f‡ fdd„ƒZ‡  ZS )ÚMessageReactionCountUpdatedaU  This class represents reaction changes on a message with anonymous reactions.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if the :attr:`chat`, :attr:`message_id`, :attr:`date` and :attr:`reactions`
    is equal.

    .. versionadded:: 20.8

    Args:
        chat (:class:`telegram.Chat`): The chat containing the message.
        message_id (:obj:`int`): Unique message identifier inside the chat.
        date (:class:`datetime.datetime`): Date of the change in Unix time
            |datetime_localization|
        reactions (Sequence[:class:`telegram.ReactionCount`]): List of reactions that are present
            on the message

    Attributes:
        chat (:class:`telegram.Chat`): The chat containing the message.
        message_id (:obj:`int`): Unique message identifier inside the chat.
        date (:class:`datetime.datetime`): Date of the change in Unix time
            |datetime_localization|
        reactions (tuple[:class:`telegram.ReactionCount`]): List of reactions that are present on
            the message
    )ÚchatÚdateÚ
message_idÚ	reactionsN©Ú
api_kwargsr   r   r   r   r   c                   sL   t ƒ j|d� || _|| _|| _t|ƒ| _| j| j| j| jf| _|  ¡  d S ©Nr   )	ÚsuperÚ__init__r   r   r   r   r   Ú	_id_attrsÚ_freeze)Úselfr   r   r   r   r   ©Ú	__class__© ú[/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_messagereactionupdated.pyr   F   s   	
z$MessageReactionCountUpdated.__init__ÚdataÚbotú
Bot | NoneÚreturnc                    sd   |   |¡}t|ƒ}t| d¡|d�|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< tƒ j	||d�S )ú,See :meth:`telegram.TelegramObject.de_json`.r   ©Útzinfor   r   ©r!   r"   )
Ú_parse_datar   r   Úgetr	   r   r
   r   r   Úde_json©Úclsr!   r"   Ú
loc_tzinfor   r   r    r+   Y   s   
z#MessageReactionCountUpdated.de_json©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   ÚintÚdtmÚdatetimer   r   r   r   Úclassmethodr+   Ú__classcell__r   r   r   r    r   %   s"    ùþýüûù&r   c                       sˆ   e Zd ZdZdZ		dddœdededejde	e
 d	e	e
 d
edB dedB dedB f‡ fdd„Zeddedddd f‡ fdd„ƒZ‡  ZS )ÚMessageReactionUpdateda¬  This class represents a change of a reaction on a message performed by a user.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if the :attr:`chat`, :attr:`message_id`, :attr:`date`, :attr:`old_reaction`
    and :attr:`new_reaction` is equal.

    .. versionadded:: 20.8

    Args:
        chat (:class:`telegram.Chat`): The chat containing the message.
        message_id (:obj:`int`): Unique message identifier inside the chat.
        date (:class:`datetime.datetime`): Date of the change in Unix time.
            |datetime_localization|
        old_reaction (Sequence[:class:`telegram.ReactionType`]): Previous list of reaction types
            that were set by the user.
        new_reaction (Sequence[:class:`telegram.ReactionType`]): New list of reaction types that
            were set by the user.
        user (:class:`telegram.User`, optional): The user that changed the reaction, if the user
            isn't anonymous.
        actor_chat (:class:`telegram.Chat`, optional): The chat on behalf of which the reaction was
            changed, if the user is anonymous.

    Attributes:
        chat (:class:`telegram.Chat`): The chat containing the message.
        message_id (:obj:`int`): Unique message identifier inside the chat.
        date (:class:`datetime.datetime`): Date of the change in Unix time.
            |datetime_localization|
        old_reaction (tuple[:class:`telegram.ReactionType`]): Previous list of reaction types
            that were set by the user.
        new_reaction (tuple[:class:`telegram.ReactionType`]): New list of reaction types that
            were set by the user.
        user (:class:`telegram.User`): Optional. The user that changed the reaction, if the user
            isn't anonymous.
        actor_chat (:class:`telegram.Chat`): Optional. The chat on behalf of which the reaction was
            changed, if the user is anonymous.
    )Ú
actor_chatr   r   r   Únew_reactionÚold_reactionÚuserNr   r   r   r   r=   r<   r>   r;   r   c          	         sf   t ƒ j|d� || _|| _|| _t|ƒ| _t|ƒ| _|| _|| _	| j| j| j| j| jf| _
|  ¡  d S r   )r   r   r   r   r   r   r=   r<   r>   r;   r   r   )	r   r   r   r   r=   r<   r>   r;   r   r   r   r    r   ˜   s   

ûzMessageReactionUpdated.__init__r!   r"   r#   r$   c                    s¦   |   |¡}t|ƒ}t| d¡|d�|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t| d¡t|ƒ|d< t	ƒ j
||d�S )	r%   r   r&   r   r=   r<   r>   r;   r(   )r)   r   r   r*   r	   r   r
   r   r   r   r+   r,   r   r   r    r+   ¹   s   
zMessageReactionUpdated.de_json)NNr/   )r0   r1   r2   r3   r4   r   r5   r6   r7   r   r   r   r   r   r8   r+   r9   r   r   r   r    r:   h   s4    %ø
öþýüûúùø
ö!&r:   )r3   r7   r6   Úcollections.abcr   Útypingr   Útelegram._chatr   Útelegram._reactionr   r   Útelegram._telegramobjectr   Útelegram._userr   Útelegram._utils.argumentparsingr	   r
   r   Útelegram._utils.datetimer   r   Útelegram._utils.typesr   Útelegramr   r   r:   r   r   r   r    Ú<module>   s   C