
    YiAk                        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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 " S S\5      r " S S\5      rg)zEThis module contains an object that represents a Telegram ChatMember.    N)TYPE_CHECKINGFinalOptional)	constants)TelegramObject)User)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'    \R                  R                  r\	\
   \S'    \R                  R                   r\	\
   \S	'    S
S.S\S\
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$ )
ChatMember"   aW  Base class for Telegram ChatMember Objects.
Currently, the following 6 types of chat members are supported:

* :class:`telegram.ChatMemberOwner`
* :class:`telegram.ChatMemberAdministrator`
* :class:`telegram.ChatMemberMember`
* :class:`telegram.ChatMemberRestricted`
* :class:`telegram.ChatMemberLeft`
* :class:`telegram.ChatMemberBanned`

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

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

.. versionchanged:: 20.0

    * As of Bot API 5.3, :class:`ChatMember` is nothing but the base class for the subclasses
      listed above and is no longer returned directly by :meth:`~telegram.Bot.get_chat`.
      Therefore, most of the arguments and attributes were removed and you should no longer
      use :class:`ChatMember` directly.
    * The constant ``ChatMember.CREATOR`` was replaced by :attr:`~telegram.ChatMember.OWNER`
    * The constant ``ChatMember.KICKED`` was replaced by :attr:`~telegram.ChatMember.BANNED`

Args:
    user (:class:`telegram.User`): Information about the user.
    status (:obj:`str`): The member's status in the chat. Can be
        :attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`,
        :attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`,
        :attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`.

Attributes:
    user (:class:`telegram.User`): Information about the user.
    status (:obj:`str`): The member's status in the chat. Can be
        :attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`,
        :attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`,
        :attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`.

)statususerADMINISTRATOROWNERBANNEDLEFTMEMBER
RESTRICTEDN
api_kwargsr   r   r   c                   > [         TU ]  US9  Xl        X l        U R                  U R                  4U l        U R                  5         g )Nr   )super__init__r   r   	_id_attrs_freeze)selfr   r   r   	__class__s       ?/app/.venv/lib/python3.13/site-packages/telegram/_chatmember.pyr   ChatMember.__init__[   s<     	J/	!))T[[1    databotr   returnc                   > U R                  U5      nU(       d  gU R                  [        U R                  [        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$ ["        R                   " UR                  S5      U5      US'   SU;   a  [%        U5      n['        US   US9US'   U [        L a3  UR                  S5      b!  SUR                  S5      0n[(        TU ]U  XUS9$ [(        TU ]A  XS9$ )	z,See :meth:`telegram.TelegramObject.de_json`.Nr   )r$   r%   r   
until_date)tzinfocan_send_media_messages)r$   r%   r   )_parse_datar   ChatMemberOwnerr   ChatMemberAdministratorr   ChatMemberMemberr   ChatMemberRestrictedr   ChatMemberLeftr   ChatMemberBannedr   getpopde_jsonr   r	   r
   r   _de_json)clsr$   r%   _class_mapping
loc_tzinfor   r    s         r!   r4   ChatMember.de_jsonk   s1   
 t$ II6JJ(NN0HHnJJ(7
 *(!3~!E!((8"45==4=QQ||DHHV$4c:V45c:J!/\0B:!VD &&4884M+N+Z3TXX>W5XYJ7#:#NNwD22r#   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__	__slots__r   ChatMemberStatusr   r   str__annotations__r   r   r   r   r   r   r   r   r   classmethodr4   __static_attributes____classcell__r    s   @r!   r   r   "   s+   'R #I ) : : H HM5:HD!2288E5:8<"33::FE#J:= 1166D%*6;"33::FE#J:=&77BBJc
BA *. 
 X&   >B"3H%"3,4UO"3	,	"3 "3r#   r   c                   ^   ^  \ rS rSrSrSr SSS.S\S\S\\	   S	\\
   4U 4S
 jjjjrSrU =r$ )r,      a  
Represents a chat member that owns the chat
and has all administrator privileges.

.. versionadded:: 13.7

Args:
    user (:class:`telegram.User`): Information about the user.
    is_anonymous (:obj:`bool`): :obj:`True`, if the
        user's presence in the chat is hidden.
    custom_title (:obj:`str`, optional): Custom title for this user.

Attributes:
    status (:obj:`str`): The member's status in the chat,
        always :tg-const:`telegram.ChatMember.OWNER`.
    user (:class:`telegram.User`): Information about the user.
    is_anonymous (:obj:`bool`): :obj:`True`, if the user's
        presence in the chat is hidden.
    custom_title (:obj:`str`): Optional. Custom title for
        this user.
)custom_titleis_anonymousNr   r   rK   rJ   r   c                   > [         TU ]  [        R                  XS9  U R	                  5          X l        X0l        S S S 5        g ! , (       d  f       g = fN)r   r   r   )r   r   r   r   	_unfrozenrK   rJ   )r   r   rK   rJ   r   r    s        r!   r   ChatMemberOwner.__init__   s?     	
 0 0tS^^&2/; s   A
Ar:   r;   r<   r=   r>   r?   r@   r   boolr   rB   r   r   rE   rF   rG   s   @r!   r,   r,      sW    , 1I '+	< *.<< < sm	< X&< <r#   r,   c            )          ^  \ rS rSrSrSr     SSS.S\S\S\S	\S
\S\S\S\S\S\S\S\S\S\\   S\\   S\\   S\\   S\\	   S\\
   4&U 4S jjjjrSrU =r$ )r-      a[  
Represents a chat member that has some additional privileges.

.. versionadded:: 13.7
.. versionchanged:: 20.0

   * Argument and attribute ``can_manage_voice_chats`` were renamed to
     :paramref:`can_manage_video_chats` and  :attr:`can_manage_video_chats` in accordance to
     Bot API 6.0.
   * The argument :paramref:`can_manage_topics` was added, which changes the position of the
     optional argument :paramref:`custom_title`.

.. versionchanged:: 21.1
    As of this version, :attr:`can_post_stories`, :attr:`can_edit_stories`,
    and :attr:`can_delete_stories` is now required. Thus, the order of arguments had to be
    changed.

Args:
    user (:class:`telegram.User`): Information about the user.
    can_be_edited (:obj:`bool`): :obj:`True`, if the bot
        is allowed to edit administrator privileges of that user.
    is_anonymous (:obj:`bool`): :obj:`True`, if the  user's
        presence in the chat is hidden.
    can_manage_chat (:obj:`bool`): :obj:`True`, if the administrator can access the chat event
        log, get boost list, see hidden supergroup and channel members, report spam messages
        and ignore slow mode. Implied by any other administrator privilege.
    can_delete_messages (:obj:`bool`): :obj:`True`, if the
        administrator can delete messages of other users.
    can_manage_video_chats (:obj:`bool`): :obj:`True`, if the
        administrator can manage video chats.

        .. versionadded:: 20.0
    can_restrict_members (:obj:`bool`): :obj:`True`, if the
        administrator can restrict, ban or unban chat members.
    can_promote_members (:obj:`bool`): :obj:`True`, if the administrator
        can add new administrators with a subset of his own privileges or demote
        administrators that he has promoted, directly or indirectly (promoted by
        administrators that were appointed by the user).
    can_change_info (:obj:`bool`): :obj:`True`, if the user can change
        the chat title, photo and other settings.
    can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite
        new users to the chat.
    can_post_messages (:obj:`bool`, optional): :obj:`True`, if the
        administrator can post messages in the channel, or access channel statistics;
        for channels only.
    can_edit_messages (:obj:`bool`, optional): :obj:`True`, if the
        administrator can edit messages of other users and can pin
        messages; for channels only.
    can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed
        to pin messages; for groups and supergroups only.
    can_post_stories (:obj:`bool`): :obj:`True`, if the administrator can post
        stories to the chat.

        .. versionadded:: 20.6
        .. versionchanged:: 21.0
            |non_optional_story_argument|
    can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit stories posted
        by other users, post stories to the chat page, pin chat stories, and access the chat's
        story archive

        .. versionadded:: 20.6
        .. versionchanged:: 21.0
            |non_optional_story_argument|
    can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
        stories posted by other users.

        .. versionadded:: 20.6
        .. versionchanged:: 21.0
            |non_optional_story_argument|
    can_manage_topics (:obj:`bool`, optional): :obj:`True`, if the user is allowed
        to create, rename, close, and reopen forum topics; for supergroups only.

        .. versionadded:: 20.0
    custom_title (:obj:`str`, optional): Custom title for this user.

Attributes:
    status (:obj:`str`): The member's status in the chat,
        always :tg-const:`telegram.ChatMember.ADMINISTRATOR`.
    user (:class:`telegram.User`): Information about the user.
    can_be_edited (:obj:`bool`): :obj:`True`, if the bot
        is allowed to edit administrator privileges of that user.
    is_anonymous (:obj:`bool`): :obj:`True`, if the  user's
        presence in the chat is hidden.
    can_manage_chat (:obj:`bool`): :obj:`True`, if the administrator can access the chat event
        log, get boost list, see hidden supergroup and channel members, report spam messages
        and ignore slow mode. Implied by any other administrator privilege.
    can_delete_messages (:obj:`bool`): :obj:`True`, if the
        administrator can delete messages of other users.
    can_manage_video_chats (:obj:`bool`): :obj:`True`, if the
        administrator can manage video chats.

        .. versionadded:: 20.0
    can_restrict_members (:obj:`bool`): :obj:`True`, if the
        administrator can restrict, ban or unban chat members, or access supergroup statistics.
    can_promote_members (:obj:`bool`): :obj:`True`, if the administrator can add new
        administrators with a subset of their own privileges or demote administrators
        that they have promoted, directly or indirectly (promoted by administrators that
        were appointed by the user).
    can_change_info (:obj:`bool`): :obj:`True`, if the user can change
        the chat title, photo and other settings.
    can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite
        new users to the chat.
    can_post_messages (:obj:`bool`): Optional. :obj:`True`, if the
        administrator can post messages in the channel or access channel statistics;
        for channels only.
    can_edit_messages (:obj:`bool`): Optional. :obj:`True`, if the
        administrator can edit messages of other users and can pin
        messages; for channels only.
    can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
        to pin messages; for groups and supergroups only.
    can_post_stories (:obj:`bool`): :obj:`True`, if the administrator can post
        stories to the chat.

        .. versionadded:: 20.6
        .. versionchanged:: 21.0
            |non_optional_story_argument|
    can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit stories posted
        by other users, post stories to the chat page, pin chat stories, and access the chat's
        story archive

        .. versionadded:: 20.6
        .. versionchanged:: 21.0
            |non_optional_story_argument|
    can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
        stories posted by other users.

        .. versionadded:: 20.6
        .. versionchanged:: 21.0
            |non_optional_story_argument|
    can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
        to create, rename, close, and reopen forum topics; for supergroups only

        .. versionadded:: 20.0
    custom_title (:obj:`str`): Optional. Custom title for this user.
)can_be_editedcan_change_infocan_delete_messagescan_delete_storiescan_edit_messagescan_edit_storiescan_invite_userscan_manage_chatcan_manage_topicscan_manage_video_chatscan_pin_messagescan_post_messagescan_post_storiescan_promote_memberscan_restrict_membersrJ   rK   Nr   r   rT   rK   r[   rV   r]   rb   ra   rU   rZ   r`   rY   rW   r_   rX   r^   r\   rJ   r   c                f  > [         TU ]  [        R                  UUS9  U R	                  5          X l        X0l        X@l        XPl        X`l	        Xpl
        Xl        Xl        Xl        Xl        Xl        Xl        Xl        Xl        UU l        UU l        UU l        S S S 5        g ! , (       d  f       g = frM   )r   r   r   r   rN   rT   rK   r[   rV   r]   rb   ra   rU   rZ   r`   rY   rW   r_   rX   r^   r\   rJ   )r   r   rT   rK   r[   rV   r]   rb   ra   rU   rZ   r`   rY   rW   r_   rX   r^   r\   rJ   r   r    s                       r!   r    ChatMemberAdministrator.__init__U  s    . 	
 8 8tPZ[^^'4&2)8 -@$0F'.B%-@$)8 *:!*:!*:!,>#5F"5F"4DD!5FD"/;D% s   A*B""
B0)NNNNNrP   rG   s   @r!   r-   r-      s   FPIF -1,0+/,0&*'*<* *.+*<*< *< 	*<
 *< "*< !%*< #*< "*< *< *< *< *< !*< $D>*<  $D>!*<" #4.#*<$ $D>%*<& sm'*<* X&+*< *<r#   r-   c            	       n   ^  \ rS rSrSrSr S
SS.S\S\\R                     S\\	   4U 4S	 jjjjr
SrU =r$ )r.   i  a  
Represents a chat member that has no additional
privileges or restrictions.

.. versionadded:: 13.7

Args:
    user (:class:`telegram.User`): Information about the user.
    until_date (:class:`datetime.datetime`, optional): Date when the user's subscription will
        expire.

        .. versionadded:: 21.5

Attributes:
    status (:obj:`str`): The member's status in the chat,
        always :tg-const:`telegram.ChatMember.MEMBER`.
    user (:class:`telegram.User`): Information about the user.
    until_date (:class:`datetime.datetime`): Optional. Date when the user's subscription will
        expire.

        .. versionadded:: 21.5

r(   Nr   r   r(   r   c                   > [         TU ]  [        R                  XS9  U R	                  5          X l        S S S 5        g ! , (       d  f       g = frM   )r   r   r   r   rN   r(   r   r   r(   r   r    s       r!   r   ChatMemberMember.__init__  s8     	
 1 1T^^;EO 	   >
Ar:   )r;   r<   r=   r>   r?   r@   r   r   datetimer   r   rE   rF   rG   s   @r!   r.   r.     sZ    0  I
 37	F
 *.	F	F X../	F
 X&	F 	Fr#   r.   c            &          ^  \ rS rSrSrSrSS.S\S\S\S	\S
\S\S\S\S\S\S\R                  S\S\S\S\S\S\S\	\
   4$U 4S jjjrSrU =r$ )r/   i  a`  
Represents a chat member that is under certain restrictions
in the chat. Supergroups only.

.. versionadded:: 13.7
.. versionchanged:: 20.0
   All arguments were made positional and their order was changed.
   The argument can_manage_topics was added.

.. versionchanged:: 20.5
  Removed deprecated argument and attribute ``can_send_media_messages``.

Args:
    user (:class:`telegram.User`): Information about the user.
    is_member (:obj:`bool`): :obj:`True`, if the user is a
        member of the chat at the moment of the request.
    can_change_info (:obj:`bool`): :obj:`True`, if the user can change
        the chat title, photo and other settings.
    can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite
        new users to the chat.
    can_pin_messages (:obj:`bool`): :obj:`True`, if the user is allowed
        to pin messages; groups and supergroups only.
    can_send_messages (:obj:`bool`): :obj:`True`, if the user is allowed
        to send text messages, contacts, invoices, locations and venues.
    can_send_polls (:obj:`bool`): :obj:`True`, if the user is allowed
        to send polls.
    can_send_other_messages (:obj:`bool`): :obj:`True`, if the user is allowed
        to send animations, games, stickers and use inline bots.
    can_add_web_page_previews (:obj:`bool`): :obj:`True`, if the user is
       allowed to add web page previews to their messages.
    can_manage_topics (:obj:`bool`): :obj:`True`, if the user is allowed to create
        forum topics.

        .. versionadded:: 20.0
    until_date (:class:`datetime.datetime`): Date when restrictions
       will be lifted for this user.

        .. versionchanged:: 20.3
            |datetime_localization|
    can_send_audios (:obj:`bool`): :obj:`True`, if the user is allowed to send audios.

        .. versionadded:: 20.1
    can_send_documents (:obj:`bool`): :obj:`True`, if the user is allowed to send documents.

        .. versionadded:: 20.1
    can_send_photos (:obj:`bool`): :obj:`True`, if the user is allowed to send photos.

        .. versionadded:: 20.1
    can_send_videos (:obj:`bool`): :obj:`True`, if the user is allowed to send videos.

        .. versionadded:: 20.1
    can_send_video_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send video
        notes.

        .. versionadded:: 20.1
    can_send_voice_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send voice
        notes.

        .. versionadded:: 20.1

Attributes:
    status (:obj:`str`): The member's status in the chat,
        always :tg-const:`telegram.ChatMember.RESTRICTED`.
    user (:class:`telegram.User`): Information about the user.
    is_member (:obj:`bool`): :obj:`True`, if the user is a
        member of the chat at the moment of the request.
    can_change_info (:obj:`bool`): :obj:`True`, if the user can change
        the chat title, photo and other settings.
    can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite
        new users to the chat.
    can_pin_messages (:obj:`bool`): :obj:`True`, if the user is allowed
        to pin messages; groups and supergroups only.
    can_send_messages (:obj:`bool`): :obj:`True`, if the user is allowed
        to send text messages, contacts, locations and venues.
    can_send_polls (:obj:`bool`): :obj:`True`, if the user is allowed
        to send polls.
    can_send_other_messages (:obj:`bool`): :obj:`True`, if the user is allowed
        to send animations, games, stickers and use inline bots.
    can_add_web_page_previews (:obj:`bool`): :obj:`True`, if the user is
       allowed to add web page previews to their messages.
    can_manage_topics (:obj:`bool`): :obj:`True`, if the user is allowed to create
        forum topics.

        .. versionadded:: 20.0
    until_date (:class:`datetime.datetime`): Date when restrictions
       will be lifted for this user.

        .. versionchanged:: 20.3
            |datetime_localization|
    can_send_audios (:obj:`bool`): :obj:`True`, if the user is allowed to send audios.

        .. versionadded:: 20.1
    can_send_documents (:obj:`bool`): :obj:`True`, if the user is allowed to send documents.

        .. versionadded:: 20.1
    can_send_photos (:obj:`bool`): :obj:`True`, if the user is allowed to send photos.

        .. versionadded:: 20.1
    can_send_videos (:obj:`bool`): :obj:`True`, if the user is allowed to send videos.

        .. versionadded:: 20.1
    can_send_video_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send video
        notes.

        .. versionadded:: 20.1
    can_send_voice_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send voice
        notes.

        .. versionadded:: 20.1

)can_add_web_page_previewsrU   rZ   r\   r^   can_send_audioscan_send_documentscan_send_messagescan_send_other_messagescan_send_photoscan_send_pollscan_send_video_notescan_send_videoscan_send_voice_notes	is_memberr(   Nr   r   rw   rU   rZ   r^   rp   rs   rq   rm   r\   r(   rn   ro   rr   ru   rt   rv   r   c                X  > [         TU ]  [        R                  UUS9  U R	                  5          X l        X0l        X@l        XPl        X`l	        Xpl
        Xl        Xl        Xl        Xl        Xl        Xl        Xl        Xl        UU l        UU l        S S S 5        g ! , (       d  f       g = frM   )r   r   r   r   rN   rw   rU   rZ   r^   rp   rs   rq   rm   r\   r(   rn   ro   rr   ru   rt   rv   )r   r   rw   rU   rZ   r^   rp   rs   rq   rm   r\   r(   rn   ro   rr   ru   rt   rv   r   r    s                      r!   r   ChatMemberRestricted.__init__-  s    , 	
 5 5DZX^^#,N)8 *:!*:!+<"(61H(3L*+<"1;O)8 ,>#)8 )8 .BD%.BD%! s   A#B
B))r;   r<   r=   r>   r?   r@   r   rQ   rk   r   r   r   rE   rF   rG   s   @r!   r/   r/     s    n`IN *.)'C'C 'C 	'C
 'C 'C  'C 'C "&'C $('C  'C %%'C 'C !'C 'C  !'C" ##'C$ #%'C( X&)'C 'Cr#   r/   c                   J   ^  \ rS rSrSrSrSS.S\S\\   4U 4S jjjr	Sr
U =r$ )	r0   iW  az  
Represents a chat member that isn't currently a member of the chat,
but may join it themselves.

.. versionadded:: 13.7

Args:
    user (:class:`telegram.User`): Information about the user.

Attributes:
    status (:obj:`str`): The member's status in the chat,
        always :tg-const:`telegram.ChatMember.LEFT`.
    user (:class:`telegram.User`): Information about the user.
 Nr   r   r   c                ^   > [         TU ]  [        R                  XS9  U R	                  5         g rM   )r   r   r   r   r   )r   r   r   r    s      r!   r   ChatMemberLeft.__init__i  s$     	
dRr#   )r;   r<   r=   r>   r?   r@   r   r   r   r   rE   rF   rG   s   @r!   r0   r0   W  s5     I *.	 X&	 r#   r0   c                   b   ^  \ rS rSrSrSrSS.S\S\R                  S\\	   4U 4S	 jjjr
SrU =r$ )
r1   is  a  
Represents a chat member that was banned in the chat and
can't return to the chat or view chat messages.

.. versionadded:: 13.7

Args:
    user (:class:`telegram.User`): Information about the user.
    until_date (:class:`datetime.datetime`): Date when restrictions
       will be lifted for this user.

        .. versionchanged:: 20.3
            |datetime_localization|

Attributes:
    status (:obj:`str`): The member's status in the chat,
        always :tg-const:`telegram.ChatMember.BANNED`.
    user (:class:`telegram.User`): Information about the user.
    until_date (:class:`datetime.datetime`): Date when restrictions
       will be lifted for this user.

        .. versionchanged:: 20.3
            |datetime_localization|

rf   Nr   r   r(   r   c                   > [         TU ]  [        R                  XS9  U R	                  5          X l        S S S 5        g ! , (       d  f       g = frM   )r   r   r   r   rN   r(   rh   s       r!   r   ChatMemberBanned.__init__  s8     	
 1 1T^^1;O rj   )r;   r<   r=   r>   r?   r@   r   rk   r   r   r   rE   rF   rG   s   @r!   r1   r1   s  sE    4  I *.	<	< %%	<
 X&	< 	<r#   r1   )r?   rk   typingr   r   r   telegramr   telegram._telegramobjectr   telegram._userr   telegram._utils.datetimer	   r
   telegram._utils.typesr   r   r   r,   r-   r.   r/   r0   r1   r{   r#   r!   <module>r      s   & L  1 1  3  Q *l3 l3^$<j $<NG<j G<T$Fz $FNkC: kC\Z 8&<z &<r#   