U
    gF                     @   s   d Z ddlmZ ddlmZmZmZ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 dd	lmZmZ dd
lmZ erd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.    )datetime)TYPE_CHECKINGOptionalSequenceTuple)Chat)ReactionCountReactionType)TelegramObject)User)parse_sequence_arg)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc                       sh   e Zd ZdZdZddeeeee	 e
e d fddZede
e e
d e
d  d	 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_kwargs)r   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__ D/tmp/pip-unpacked-wheel-swnnwir2/telegram/_messagereactionupdated.pyr   D   s    	
z$MessageReactionCountUpdated.__init__r   databotreturnc                    sl   |  |}|sdS t|}t|d|d|d< t|d||d< t|d||d< t j||dS ),See :meth:`telegram.TelegramObject.de_json`.Nr   tzinfor   r   r#   r$   )	_parse_datar   r   getr   de_jsonr   de_listr   clsr#   r$   Z
loc_tzinfor   r    r!   r,   W   s    
z#MessageReactionCountUpdated.de_json)N)__name__
__module____qualname____doc__	__slots__r   intr   r   r   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eeeee	 ee	 e
e e
e e
e d fddZede
e e
d e
d  d	 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<   r9   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<   r9   r   r   )	r   r   r   r   r;   r:   r<   r9   r   r   r    r!   r      s    

zMessageReactionUpdated.__init__r   r"   c                    s   |  |}|sdS t|}t|d|d|d< t|d||d< t|d||d< t|d||d< t|d||d< t|d||d< t	 j||d	S )
r&   Nr   r'   r   r;   r:   r<   r9   r)   )
r*   r   r   r+   r   r,   r	   r-   r   r   r.   r   r    r!   r,      s    
zMessageReactionUpdated.de_json)NN)N)r0   r1   r2   r3   r4   r   r5   r   r   r	   r   r   r   r   r6   r,   r7   r    r    r   r!   r8   k   s.   %  
!  r8   N)r3   r   typingr   r   r   r   Ztelegram._chatr   Ztelegram._reactionr   r	   Ztelegram._telegramobjectr
   Ztelegram._userr   Ztelegram._utils.argumentparsingr   Ztelegram._utils.datetimer   r   Ztelegram._utils.typesr   Ztelegramr   r   r8   r    r    r    r!   <module>   s   H