
    ՟fMk                        d Z ddlZddlmZmZmZ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rdd	lmZ  G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)zEThis module contains an object that represents a Telegram ChatMember.    N)TYPE_CHECKINGDictFinalOptionalType)	constants)TelegramObject)User)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc            	           e Zd ZU dZdZej                  j                  Zee	   e
d<   	 ej                  j                  Zee	   e
d<   	 ej                  j                  Zee	   e
d<   	 ej                  j                  Zee	   e
d<   	 ej                  j                  Zee	   e
d<   	 ej                  j                  Zee	   e
d<   	 d	d
dede	dee   f fdZe	 ddee   ded   ded    f fd       Z xZS )
ChatMembera  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         |   |       || _        || _        | j                  | j                  f| _        | j                          y )Nr   )super__init__r   r   	_id_attrs_freeze)selfr   r   r   	__class__s       O/var/www/cvtools/html/venv/lib/python3.12/site-packages/telegram/_chatmember.pyr   zChatMember.__init__[   s@     	J/	!))T[[1    databotr   returnc                    | j                  |      }|sy| j                  t        | j                  t        | j
                  t        | j                  t        | j                  t        | j                  t        i}| t        u r8|j                  d      |v r%||j                  d         j!                  ||      S t#        j                   |j                  d      |      |d<   d|v rt%        |      }t'        |d   |      |d<   | t        u r6|j                  d      %d|j                  d      i}t(        | U  |||      S t(        | A  ||      S )	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   zChatMember.de_jsonk   s9   
 t$ II6JJ(NN0HHnJJ(7
 *(!3~!E!$((8"45==4S=QQ||DHHV$4c:V45c:J!/\0B:!VD &&4884M+N+Z3TXX>W5XYJ7#3:#NNwDc22r#   N)__name__
__module____qualname____doc__	__slots__r   ChatMemberStatusr   r   str__annotations__r   r   r   r   r   r
   r   r   r   classmethodr4   __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                   N     e Zd ZdZdZ	 d
dddededee   dee	   f fd	Z
 xZS )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   rG   rF   r   c                    t         |   t        j                  ||       | j	                         5  || _        || _        d d d        y # 1 sw Y   y xY wN)r   r   r   )r   r   r   r   	_unfrozenrG   rF   )r    r   rG   rF   r   r!   s        r"   r   zChatMemberOwner.__init__   sN     	
 0 0t
S^^ 	<&2D/;D	< 	< 	<s   A

Ar9   r:   r;   r<   r=   r>   r
   boolr   r@   r   r   rC   rD   s   @r"   r,   r,      sW    , 1I '+	< *.<< < sm	< X&< <r#   r,   c            )            e Zd ZdZdZ	 	 	 	 	 ddddedededed	ed
ededededededededee   dee   dee   dee   dee   dee	   f& fdZ
 xZS )r-   a7  
    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_membersrF   rG   Nr   r   rN   rG   rU   rP   rW   r\   r[   rO   rT   rZ   rS   rQ   rY   rR   rX   rV   rF   r   c                ~   t         |   t        j                  ||       | j	                         5  || _        || _        || _        || _        || _	        || _
        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        d d d        y # 1 sw Y   y xY wrI   )r   r   r   r   rJ   rN   rG   rU   rP   rW   r\   r[   rO   rT   rZ   rS   rQ   rY   rR   rX   rV   rF   )r    r   rN   rG   rU   rP   rW   r\   r[   rO   rT   rZ   rS   rQ   rY   rR   rX   rV   rF   r   r!   s                       r"   r   z ChatMemberAdministrator.__init__U  s    . 	
 8 8tPZ[^^ 	<'4D&2D)8D -@D$0FD'.BD%-@D$)8D *:D!*:D!*:D!,>D#5FD"5FD"4DD!5FD"/;D%	< 	< 	<s   A8B33B<)NNNNNrK   rD   s   @r"   r-   r-      s   FPIF -1,0+/,0&*'*<* *.+*<*< *< 	*<
 *< "*< !%*< #*< "*< *< *< *< *< !*< $D>*<  $D>!*<" #4.#*<$ $D>%*<& sm'*<* X&+*< *<r#   r-   c            	       ^     e Zd ZdZdZ	 d	dddedeej                     dee   f fdZ	 xZ
S )
r.   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         |   t        j                  ||       | j	                         5  || _        d d d        y # 1 sw Y   y xY wrI   )r   r   r   r   rJ   r(   r    r   r(   r   r!   s       r"   r   zChatMemberMember.__init__  sI     	
 1 1T^^ 	F;EDO	F 	F 	F   AAr9   )r:   r;   r<   r=   r>   r
   r   datetimer   r   rC   rD   s   @r"   r.   r.     sZ    0  I
 37	F
 *.	F	F X../	F
 X&	F 	Fr#   r.   c            &            e Zd ZdZdZdddedededed	ed
edededededej                  dededededededee	   f$ fdZ
 xZS )r/   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_previewsrO   rT   rV   rX   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   ro   rO   rT   rX   rh   rk   ri   re   rV   r(   rf   rg   rj   rm   rl   rn   r   c                p   t         |   t        j                  ||       | j	                         5  || _        || _        || _        || _        || _	        || _
        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        d d d        y # 1 sw Y   y xY wrI   )r   r   r   r   rJ   ro   rO   rT   rX   rh   rk   ri   re   rV   r(   rf   rg   rj   rm   rl   rn   )r    r   ro   rO   rT   rX   rh   rk   ri   re   rV   r(   rf   rg   rj   rm   rl   rn   r   r!   s                      r"   r   zChatMemberRestricted.__init__-  s    , 	
 5 5DZX^^ 	C#,DN)8D *:D!*:D!+<D"(6D1HD(3LD*+<D"1;DO)8D ,>D#)8D )8D .BD%.BD%!	C 	C 	Cs   A1B,,B5)r:   r;   r<   r=   r>   r
   rL   rc   r   r   r   rC   rD   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                   <     e Zd ZdZdZdddedee   f fdZ xZ	S )r0   a  
    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                f    t         |   t        j                  ||       | j	                          y rI   )r   r   r   r   r   )r    r   r   r!   s      r"   r   zChatMemberLeft.__init__i  s&     	
dzRr#   )
r:   r;   r<   r=   r>   r
   r   r   r   rC   rD   s   @r"   r0   r0   W  s5     I *.	 X&	 r#   r0   c                   T     e Zd ZdZdZdddedej                  dee   f fdZ	 xZ
S )	r1   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|

    r_   Nr   r   r(   r   c                    t         |   t        j                  ||       | j	                         5  || _        d d d        y # 1 sw Y   y xY wrI   )r   r   r   r   rJ   r(   ra   s       r"   r   zChatMemberBanned.__init__  sE     	
 1 1T^^ 	<1;DO	< 	< 	<rb   )r:   r;   r<   r=   r>   r
   rc   r   r   r   rC   rD   s   @r"   r1   r1   s  sE    4  I *.	<	< %%	<
 X&	< 	<r#   r1   )r=   rc   typingr   r   r   r   r   telegramr   telegram._telegramobjectr	   telegram._userr
   telegram._utils.datetimer   r   telegram._utils.typesr   r   r   r,   r-   r.   r/   r0   r1   rr   r#   r"   <module>r|      s   & L  = =  3  Q *l3 l3^$<j $<NG<j G<T$Fz $FNkC: kC\Z 8&<z &<r#   