
    Yi!                         S r SSKrSSKJrJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  SS	KJrJr  SS
KJr  \(       a  SSKJr   " S S\5      rg)zLThis module contains an object that represents a Telegram ChatMemberUpdated.    N)TYPE_CHECKINGOptionalUnion)Chat)ChatInviteLink)
ChatMember)TelegramObject)User)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc                   V  ^  \ rS rSrSrSr   SSS.S\S\S\R                  S	\	S
\	S\
\   S\
\   S\
\   S\
\   4U 4S jjjjr\ SS\
\   S\
S   S\
S    4U 4S jjj5       rS\S\\\4   4S jrS\\\\\\\R                  \4   \\\\R                  \4   4   4   4S jrSrU =r$ )ChatMemberUpdated#   a
  This object represents changes in the status of a chat member.

Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`chat`, :attr:`from_user`, :attr:`date`,
:attr:`old_chat_member` and :attr:`new_chat_member` are equal.

.. versionadded:: 13.4

Note:
    In Python :keyword:`from` is a reserved word. Use :paramref:`from_user` instead.

Examples:
    :any:`Chat Member Bot <examples.chatmemberbot>`

Args:
    chat (:class:`telegram.Chat`): Chat the user belongs to.
    from_user (:class:`telegram.User`): Performer of the action, which resulted in the change.
    date (:class:`datetime.datetime`): Date the change was done in Unix time. Converted to
        :class:`datetime.datetime`.

        .. versionchanged:: 20.3
            |datetime_localization|
    old_chat_member (:class:`telegram.ChatMember`): Previous information about the chat member.
    new_chat_member (:class:`telegram.ChatMember`): New information about the chat member.
    invite_link (:class:`telegram.ChatInviteLink`, optional): Chat invite link, which was used
        by the user to join the chat. For joining by invite link events only.
    via_chat_folder_invite_link (:obj:`bool`, optional): :obj:`True`, if the user joined the
        chat via a chat folder invite link

        .. versionadded:: 20.3
    via_join_request (:obj:`bool`, optional): :obj:`True`, if the user joined the chat after
        sending a direct join request without using an invite link and being approved by
        an administrator

        .. versionadded:: 21.2

Attributes:
    chat (:class:`telegram.Chat`): Chat the user belongs to.
    from_user (:class:`telegram.User`): Performer of the action, which resulted in the change.
    date (:class:`datetime.datetime`): Date the change was done in Unix time. Converted to
        :class:`datetime.datetime`.

        .. versionchanged:: 20.3
            |datetime_localization|
    old_chat_member (:class:`telegram.ChatMember`): Previous information about the chat member.
    new_chat_member (:class:`telegram.ChatMember`): New information about the chat member.
    invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link, which was used
        by the user to join the chat. For joining by invite link events only.
    via_chat_folder_invite_link (:obj:`bool`): Optional. :obj:`True`, if the user joined the
        chat via a chat folder invite link

        .. versionadded:: 20.3
    via_join_request (:obj:`bool`): Optional. :obj:`True`, if the user joined the chat after
        sending a direct join request without using an invite link and being approved
        by an administrator

        .. versionadded:: 21.2

)chatdate	from_userinvite_linknew_chat_memberold_chat_membervia_chat_folder_invite_linkvia_join_requestN
api_kwargsr   r   r   r   r   r   r   r   r   c	                  > [         T
U ]  U	S9  Xl        X l        X0l        X@l        XPl        Xpl        X`l        Xl	        U R                  U R                  U R                  U R
                  U R                  4U l
        U R                  5         g )Nr   )super__init__r   r   r   r   r   r   r   r   	_id_attrs_freeze)selfr   r   r   r   r   r   r   r   r   	__class__s             F/app/.venv/lib/python3.13/site-packages/telegram/_chatmemberupdated.pyr   ChatMemberUpdated.__init__k   s     	J/	('+	+:+:;V( 6A0@ IINNII    
 	    databotr   returnc                 :  > U R                  U5      nU(       d  g[        U5      n[        R                  " UR	                  S5      U5      US'   [
        R                  " UR                  SS5      U5      US'   [        UR	                  S5      US9US'   [        R                  " UR	                  S5      U5      US'   [        R                  " UR	                  S5      U5      US'   [        R                  " UR	                  S	5      U5      US	'   [        TU ]  XS
9$ )z,See :meth:`telegram.TelegramObject.de_json`.Nr   fromr   r   )tzinfor   r   r   )r&   r'   )_parse_datar   r   de_jsongetr
   popr   r   r   r   )clsr&   r'   
loc_tzinfor"   s       r#   r-   ChatMemberUpdated.de_json   s    
 t$ 2#6
||DHHV$4c:V LL&$)?E[%dhhv&6zJV","4"4TXX>O5PRU"V","4"4TXX>O5PRU"V,44TXXm5LcR]wD22r%   	attributec                      U R                   U   n U R                  U   nX#4$ ! [         a    S n N!f = f! [         a    S n X#4$ f = fN)r   KeyErrorr   )r!   r3   oldnews       r#   _get_attribute_difference+ChatMemberUpdated._get_attribute_difference   sg    	&&y1C	&&y1C x  	C	
  	Cx	s   $ 6 33AAc                    U R                   R                  5       nUR                  S5      nU R                  R                  5       nUR                  S5      nS [	        UR                  5       5      [	        UR                  5       5      -   5       nU Vs0 s H  ofU R                  U5      _M     nnX$:w  a/  U R                   R                  U R                  R                  4US'   U$ s  snf )a  Computes the difference between :attr:`old_chat_member` and :attr:`new_chat_member`.

Example:
    .. code:: pycon

        >>> chat_member_updated.difference()
        {'custom_title': ('old title', 'new title')}

Note:
    To determine, if the :attr:`telegram.ChatMember.user` attribute has changed, *every*
    attribute of the user will be checked.

.. versionadded:: 13.5

Returns:
    dict[:obj:`str`, tuple[:class:`object`, :class:`object`]]: A dictionary mapping
    attribute names to tuples of the form ``(old_value, new_value)``
userc              3   *   #    U  H	  oS    v   M     g7f)r   N ).0entrys     r#   	<genexpr>/ChatMemberUpdated.difference.<locals>.<genexpr>   s     Z,Y5Ah,Ys   )r   to_dictr/   r   setitemsr9   r<   )r!   old_dictold_user_dictnew_dictnew_user_dict
attributesr3   results           r#   
differenceChatMemberUpdated.difference   s    8 ''//1 V,''//1 V, [C0@,ACHXDY,YZ
XbcXb9T;;IFFXbc)"22779M9M9R9RSF6N	 ds   C()	r   r   r   r   r   r   r   r   r   )NNNr5   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r
   datetimer   r   r   boolr   r   classmethodr-   strtupleobjectr9   dictr   rL   __static_attributes____classcell__)r"   s   @r#   r   r   #   sR   :x	I$ 156:+/" *."" " 	"
 $" $" n-" &.d^" #4." X&" "H >B3H%3,4UO3	%	&3 3*3 5;P )	#tX..45uS$HYHY[_=_7``	
	
) )r%   r   )rR   rT   typingr   r   r   telegram._chatr   telegram._chatinvitelinkr   telegram._chatmemberr   telegram._telegramobjectr	   telegram._userr
   telegram._utils.datetimer   r   telegram._utils.typesr   telegramr   r   r>   r%   r#   <module>rf      s=   & S  1 1  3 + 3  Q *x xr%   