
    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 " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)zFThis module contains the classes that represent Telegram MessageOigin.    N)TYPE_CHECKINGFinalOptional)	constants)Chat)TelegramObject)User)enum)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc            	         ^  \ rS rSr% SrSr\R                  R                  r\	\
   \S'    \R                  R                  r\	\
   \S'    \R                  R                  r\	\
   \S'    \R                  R                  r\	\
   \S'    SS	.S
\
S\R                  S\\   4U 4S jjjr\ SS\\   S\S   S\S    4U 4S jjj5       rSrU =r$ )MessageOrigin#   aK  
Base class for telegram MessageOrigin object, it can be one of:

* :class:`MessageOriginUser`
* :class:`MessageOriginHiddenUser`
* :class:`MessageOriginChat`
* :class:`MessageOriginChannel`

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

.. versionadded:: 20.8

Args:
    type (:obj:`str`): Type of the message origin, can be on of:
        :attr:`~telegram.MessageOrigin.USER`, :attr:`~telegram.MessageOrigin.HIDDEN_USER`,
        :attr:`~telegram.MessageOrigin.CHAT`, or :attr:`~telegram.MessageOrigin.CHANNEL`.
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|

Attributes:
    type (:obj:`str`): Type of the message origin, can be on of:
        :attr:`~telegram.MessageOrigin.USER`, :attr:`~telegram.MessageOrigin.HIDDEN_USER`,
        :attr:`~telegram.MessageOrigin.CHAT`, or :attr:`~telegram.MessageOrigin.CHANNEL`.
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
)datetypeUSERHIDDEN_USERCHATCHANNELN
api_kwargsr   r   r   c                   > [         TU ]  US9  [        R                  " [        R
                  X5      U l        X l        U R                  U R                  4U l        U R                  5         g )Nr   )
super__init__r
   
get_memberr   MessageOriginTyper   r   	_id_attrs_freeze)selfr   r   r   	__class__s       B/app/.venv/lib/python3.13/site-packages/telegram/_messageorigin.pyr   MessageOrigin.__init__N   sV     	J/)D)DdQ	'+	 IIII
 	    databotr   returnc                   > U R                  U5      nU(       d  gU R                  [        U R                  [        U R
                  [        U R                  [        0nU [        L a5  UR                  S5      U;   a   X1R                  S5         R                  XS9$ [        U5      n[        UR                  S5      US9US'   SU;   a)  [        R                  " UR                  S5      U5      US'   SU;   a)  [         R                  " UR                  S5      U5      US'   SU;   a)  [         R                  " UR                  S5      U5      US'   ["        TU ]1  XS9$ )	zxConverts JSON data to the appropriate :class:`MessageOrigin` object, i.e. takes
care of selecting the correct subclass.
Nr   )r&   r'   r   )tzinfosender_usersender_chatchat)_parse_datar   MessageOriginUserr   MessageOriginHiddenUserr   MessageOriginChatr   MessageOriginChannelr   getpopde_jsonr   r   r	   r   r   )clsr&   r'   _class_mapping
loc_tzinfor"   s        r#   r5   MessageOrigin.de_json`   s(    t$ HH'OO4HH'KK-	:
 -DHHV$4$F!((6"23;;;OO1#6
%dhhv&6zJVD "&,,txx/F"LDD "&,,txx/F"LDT><<(8#>DLwD22r%   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r   r   str__annotations__r   r   r   datetimer   r   r   classmethodr5   __static_attributes____classcell__r"   s   @r#   r   r   #   s    8I
 !2277D%*7<'99EEKsEC 2277D%*7<#55==GU3Z=? *. 
 X& $ >B 3H% 3,4UO 3	/	" 3  3r%   r   c                   b   ^  \ rS rSrSrSrSS.S\R                  S\S\\	   4U 4S	 jjjr
SrU =r$ )
r/      aB  
The message was originally sent by a known user.

.. versionadded:: 20.8

Args:
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    sender_user (:class:`telegram.User`): User that sent the message originally.

Attributes:
    type (:obj:`str`): Type of the message origin. Always
        :tg-const:`~telegram.MessageOrigin.USER`.
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    sender_user (:class:`telegram.User`): User that sent the message originally.
)r+   Nr   r   r+   r   c                   > [         TU ]  U R                  XS9  U R                  5          X l        S S S 5        g ! , (       d  f       g = fN)r   r   r   )r   r   r   	_unfrozenr+   )r!   r   r+   r   r"   s       r#   r   MessageOriginUser.__init__   s7     	diidJ^^%0 	   :
A)r;   r<   r=   r>   r?   r@   rC   r	   r   r   r   rE   rF   rG   s   @r#   r/   r/      sE    $ !I *.
1
1 
1
 X&
1 
1r%   r/   c                   b   ^  \ rS rSrSrSrSS.S\R                  S\S\\	   4U 4S	 jjjr
SrU =r$ )
r0      aV  
The message was originally sent by an unknown user.

.. versionadded:: 20.8

Args:
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    sender_user_name (:obj:`str`): Name of the user that sent the message originally.

Attributes:
    type (:obj:`str`): Type of the message origin. Always
        :tg-const:`~telegram.MessageOrigin.HIDDEN_USER`.
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    sender_user_name (:obj:`str`): Name of the user that sent the message originally.
)sender_user_nameNr   r   rQ   r   c                   > [         TU ]  U R                  XS9  U R                  5          X l        S S S 5        g ! , (       d  f       g = frK   )r   r   r   rL   rQ   )r!   r   rQ   r   r"   s       r#   r    MessageOriginHiddenUser.__init__   s9     	d..TQ^^)9! rN   )r;   r<   r=   r>   r?   r@   rC   rA   r   r   r   rE   rF   rG   s   @r#   r0   r0      sE    $ &I *.
:
: 
:
 X&
: 
:r%   r0   c                   r   ^  \ rS rSrSrSr SSS.S\R                  S\S\\	   S	\\
   4U 4S
 jjjjrSrU =r$ )r1      a  
The message was originally sent on behalf of a chat to a group chat.

.. versionadded:: 20.8

Args:
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    sender_chat (:class:`telegram.Chat`): Chat that sent the message originally.
    author_signature (:obj:`str`, optional): For messages originally sent by an anonymous chat
        administrator, original message author signature

Attributes:
    type (:obj:`str`): Type of the message origin. Always
        :tg-const:`~telegram.MessageOrigin.CHAT`.
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    sender_chat (:class:`telegram.Chat`): Chat that sent the message originally.
    author_signature (:obj:`str`): Optional. For messages originally sent by an anonymous chat
        administrator, original message author signature
)author_signaturer,   Nr   r   r,   rV   r   c                   > [         TU ]  U R                  XS9  U R                  5          X l        X0l        S S S 5        g ! , (       d  f       g = frK   )r   r   r   rL   r,   rV   )r!   r   r,   rV   r   r"   s        r#   r   MessageOriginChat.__init__   s=     	diidJ^^%03C! s   A  
Ar:   )r;   r<   r=   r>   r?   r@   rC   r   r   rA   r   r   rE   rF   rG   s   @r#   r1   r1      sd    ,I +/	D *.DD D #3-	D X&D Dr%   r1   c                   v   ^  \ rS rSrSrSr SSS.S\R                  S\S\S	\	\
   S
\	\   4
U 4S jjjjrSrU =r$ )r2      a  
The message was originally sent to a channel chat.

.. versionadded:: 20.8

Args:
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    chat (:class:`telegram.Chat`): Channel chat to which the message was originally sent.
    message_id (:obj:`int`): Unique message identifier inside the chat.
    author_signature (:obj:`str`, optional): Signature of the original post author.

Attributes:
    type (:obj:`str`): Type of the message origin. Always
        :tg-const:`~telegram.MessageOrigin.CHANNEL`.
    date (:obj:`datetime.datetime`): Date the message was sent originally.
        |datetime_localization|
    chat (:class:`telegram.Chat`): Channel chat to which the message was originally sent.
    message_id (:obj:`int`): Unique message identifier inside the chat.
    author_signature (:obj:`str`): Optional. Signature of the original post author.
)rV   r-   
message_idNr   r   r-   r[   rV   r   c                   > [         TU ]  U R                  XS9  U R                  5          X l        X0l        X@l        S S S 5        g ! , (       d  f       g = frK   )r   r   r   rL   r-   r[   rV   )r!   r   r-   r[   rV   r   r"   s         r#   r   MessageOriginChannel.__init__  sA     	dllM^^"I#-O3C! s   A
Ar:   )r;   r<   r=   r>   r?   r@   rC   r   intr   rA   r   r   rE   rF   rG   s   @r#   r2   r2      so    ,I +/D *.DD D 	D
 #3-D X&D Dr%   r2   )r?   rC   typingr   r   r   telegramr   telegram._chatr   telegram._telegramobjectr   telegram._userr	   telegram._utilsr
   telegram._utils.datetimer   r   telegram._utils.typesr   r   r   r/   r0   r1   r2    r%   r#   <module>rh      su   & M  1 1   3    Q *^3N ^3B1 1D:m :D(D (DV+D= +Dr%   