
    iDL                       d Z ddlmZ ddlmZmZmZmZmZm	Z	 ddl
ZddlmZ ddlmZ ddlm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 er8ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl(m!Z) ddl*m+Z,m-Z.m/Z/mZ0m1Z2 dZ3 G d d          Z4 G d de4          Z5 G d de5          Z6 G d de5ej7        j8                  Z-dS )a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotations)AnyDictListOptionalTYPE_CHECKINGUnionN   )Asset)Colour)DefaultAvatar)PublicUserFlags)snowflake_time_bytes_to_base64_dataMISSING_get_as_snowflake)PrimaryGuild)Collectible)Self)datetime)	DMChannel)Guild)Message)ConnectionState)PartialUserUserAvatarDecorationDatar   UserCollectibles)r   
ClientUserc                      e Zd ZU dZded<   dS )_UserTag intidN)__name__
__module____qualname__	__slots____annotations__r"       S/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/user.pyr!   r!   ?   s         IGGGGGr*   r!   c                     e Zd ZU dZerFded<   ded<   ded<   ded<   d	ed
<   d	ed<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   dHdZdIdZdId ZdJd#Z	dJd$Z
dKd%ZdLd&ZedMd)            ZdNd+ZedOd-            ZedPd/            ZedQd1            ZedQd2            ZedPd3            ZedRd4            ZedPd5            ZedSd7            ZedSd8            ZedTd:            ZedTd;            ZedId<            ZedUd>            ZedId?            ZedVdA            ZedWdC            Z dXdFZ!dGS )YBaseUser)namer$   discriminatorglobal_name_avatar_banner_accent_colourbotsystem_public_flags_state_avatar_decoration_data_primary_guild_collectiblesstrr.   r#   r$   r/   Optional[str]r0   boolr4   r5   r   r7   r1   r2   Optional[int]r3   r6   zOptional[AvatarDecorationData]r8   zOptional[PrimaryGuildPayload]r9   z!Optional[UserCollectiblesPayload]r:   statedata&Union[UserPayload, PartialUserPayload]returnNonec               >    || _         |                     |           d S N)r7   _update)selfr?   r@   s      r+   __init__zBaseUser.__init__f   s!    Tr*   c                X    d| j          d| j        d| j        d| j         d| j         dS )Nz<BaseUser id= name= global_name= bot=z system=>)r$   r.   r0   r4   r5   rG   s    r+   __repr__zBaseUser.__repr__j   sZ    5DG 5 549 5 5TEU 5 5H5 5&*k5 5 5	
r*   c                H    | j         dk    r| j        S | j         d| j          S )N0#)r/   r.   rN   s    r+   __str__zBaseUser.__str__p   s1    $$9)22d0222r*   otherobjectc                L    t          |t                    o|j        | j        k    S rE   )
isinstancer!   r$   rG   rT   s     r+   __eq__zBaseUser.__eq__u   s     %**Bux47/BBr*   c                .    |                      |           S rE   )rY   rX   s     r+   __ne__zBaseUser.__ne__x   s    ;;u%%%%r*   c                    | j         dz	  S )N   r$   rN   s    r+   __hash__zBaseUser.__hash__{   s    w"}r*   c                j   |d         | _         t          |d                   | _        |d         | _        |                    d          | _        |d         | _        |                    dd           | _        |                    dd           | _        |                    dd	          | _	        |                    d
d          | _
        |                    dd          | _        |                    d          | _        |                    dd           | _        |                    dd           | _        d S )Nusernamer$   r/   r0   avatarbanneraccent_colorpublic_flagsr   r4   Fr5   avatar_decoration_dataprimary_guildcollectibles)r.   r#   r$   r/   getr0   r1   r2   r3   r6   r4   r5   r8   r9   r:   )rG   r@   s     r+   rF   zBaseUser._update~   s    $	d4j//!/288M22H~xx$//"hh~t<<!XXna8888E5))hhx//'+xx0H'I'I$"hh==!XXnd;;r*   userr   c                h   |                      |           }|j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j        |_        |j	        |_	        |j
        |_
        |j        |_        |j        |_        |j        |_        |S rE   )__new__r.   r$   r/   r0   r1   r2   r3   r4   r7   r6   r8   r9   r:   )clsrj   rG   s      r+   _copyzBaseUser._copy   s    {{3I	'!/+||"18k!/'+'C$"1!/r*   Dict[str, Any]c                P    | j         | j        | j        | j        | j        | j        dS )N)ra   r$   rb   r/   r0   r4   )r.   r$   r1   r/   r0   r4   rN   s    r+   _to_minimal_user_jsonzBaseUser._to_minimal_user_json   s1    	'l!/+8
 
 	
r*   r   c                4    t          j        | j                  S )zD:class:`PublicUserFlags`: The publicly available flags the user has.)r   _from_valuer6   rN   s    r+   re   zBaseUser.public_flags   s     *4+=>>>r*   Optional[Asset]c                ^    | j         %t          j        | j        | j        | j                   S dS )a  Optional[:class:`Asset`]: Returns an :class:`Asset` for the avatar the user has.

        If the user has not uploaded a global avatar, ``None`` is returned.
        If you want the avatar that a user has displayed, consider :attr:`display_avatar`.
        N)r1   r   _from_avatarr7   r$   rN   s    r+   rb   zBaseUser.avatar   s,     <#%dk47DLIIItr*   r   c                    | j         dv r | j        dz	  t          t                    z  }nt	          | j                   dz  }t          j        | j        |          S )z<:class:`Asset`: Returns the default avatar for a given user.)rQ   0000r]      )r/   r$   lenr   r#   r   _from_default_avatarr7   )rG   	avatar_ids     r+   default_avatarzBaseUser.default_avatar   sV     ..B#m*<*<<IID.//!3I)$+yAAAr*   c                    | j         p| j        S )z:class:`Asset`: Returns the user's display avatar.

        For regular users this is just their default avatar or uploaded avatar.

        .. versionadded:: 2.0
        )rb   r}   rN   s    r+   display_avatarzBaseUser.display_avatar   s     {1d11r*   c                ^    | j         %t          j        | j        | j         d                   S dS )zOptional[:class:`Asset`]: Returns an :class:`Asset` for the avatar decoration the user has.

        If the user has not set an avatar decoration, ``None`` is returned.

        .. versionadded:: 2.4
        Nasset)r8   r   _from_avatar_decorationr7   rN   s    r+   avatar_decorationzBaseUser.avatar_decoration   s0     '30d>Z[b>cdddtr*   c                >    | j         t          | j         d          S dS )zOptional[:class:`int`]: Returns the SKU ID of the avatar decoration the user has.

        If the user has not set an avatar decoration, ``None`` is returned.

        .. versionadded:: 2.4
        Nsku_id)r8   r   rN   s    r+   avatar_decoration_sku_idz!BaseUser.avatar_decoration_sku_id   s%     '3$T%A8LLLtr*   c                ^    | j         dS t          j        | j        | j        | j                   S )zOptional[:class:`Asset`]: Returns the user's banner asset, if available.

        .. versionadded:: 2.0


        .. note::
            This information is only available via :meth:`Client.fetch_user`.
        N)r2   r   _from_user_bannerr7   r$   rN   s    r+   rc   zBaseUser.banner   s,     <4&t{DGT\JJJr*   Optional[Colour]c                <    | j         dS t          | j                   S )a  Optional[:class:`Colour`]: Returns the user's accent colour, if applicable.

        A user's accent colour is only shown if they do not have a banner.
        This will only be available if the user explicitly sets a colour.

        There is an alias for this named :attr:`accent_color`.

        .. versionadded:: 2.0

        .. note::

            This information is only available via :meth:`Client.fetch_user`.
        N)r3   r   rN   s    r+   accent_colourzBaseUser.accent_colour   s#     &4d)***r*   c                    | j         S )a  Optional[:class:`Colour`]: Returns the user's accent color, if applicable.

        A user's accent color is only shown if they do not have a banner.
        This will only be available if the user explicitly sets a color.

        There is an alias for this named :attr:`accent_colour`.

        .. versionadded:: 2.0

        .. note::

            This information is only available via :meth:`Client.fetch_user`.
        )r   rN   s    r+   rd   zBaseUser.accent_color  s     !!r*   r   c                (    t          j                    S )z:class:`Colour`: A property that returns a colour denoting the rendered colour
        for the user. This always returns :meth:`Colour.default`.

        There is an alias for this named :attr:`color`.
        )r   defaultrN   s    r+   colourzBaseUser.colour  s     ~r*   c                    | j         S )z:class:`Colour`: A property that returns a color denoting the rendered color
        for the user. This always returns :meth:`Colour.default`.

        There is an alias for this named :attr:`colour`.
        )r   rN   s    r+   colorzBaseUser.color"  s     {r*   c                    d| j          dS )zI:class:`str`: Returns a string that allows you to mention the given user.z<@rM   r^   rN   s    r+   mentionzBaseUser.mention+  s     DGr*   r   c                *    t          | j                  S )z:class:`datetime.datetime`: Returns the user's creation time in UTC.

        This is when the user's Discord account was created.
        )r   r$   rN   s    r+   
created_atzBaseUser.created_at0  s     dg&&&r*   c                ,    | j         r| j         S | j        S )z:class:`str`: Returns the user's display name.

        For regular users this is just their global name or their username,
        but if they have a guild specific nickname then that
        is returned instead.
        )r0   r.   rN   s    r+   display_namezBaseUser.display_name8  s       	$##yr*   r   c                x    | j         t          | j        | j                   S t          j        | j                  S )zW:class:`PrimaryGuild`: Returns the user's primary guild.

        .. versionadded:: 2.6Nr?   r@   )r9   r   r7   _defaultrN   s    r+   rg   zBaseUser.primary_guildD  s8    
 *dk8KLLLL$T[111r*   List[Collectible]c                `      j         g S  fd j                                         D             S )znList[:class:`Collectible`]: Returns a list of the user's collectibles.

        .. versionadded:: 2.7
        Nc                H    g | ]\  }}|t          j        ||           S ))r?   typer@   )r   r7   ).0keyvaluerG   s      r+   
<listcomp>z)BaseUser.collectibles.<locals>.<listcomp>U  s4    {{{euz{$+CeDDD{{{r*   )r:   itemsrN   s   `r+   rh   zBaseUser.collectiblesM  s=     %I{{{{W[WiWoWoWqWq{{{{r*   messager   c                V     |j         rdS t           fd|j        D                       S )a;  Checks if the user is mentioned in the specified message.

        Parameters
        -----------
        message: :class:`Message`
            The message to check if you're mentioned in.

        Returns
        -------
        :class:`bool`
            Indicates if the user is mentioned in the message.
        Tc              3  8   K   | ]}|j         j         k    V  d S rE   r^   )r   rj   rG   s     r+   	<genexpr>z(BaseUser.mentioned_in.<locals>.<genexpr>h  s,      CC$47dg%CCCCCCr*   )mention_everyoneanymentions)rG   r   s   ` r+   mentioned_inzBaseUser.mentioned_inW  s;     # 	4CCCC'2BCCCCCCr*   N)r?   r   r@   rA   rB   rC   rB   r;   )rT   rU   rB   r=   )rB   r#   )r@   rA   rB   rC   )rj   r   rB   r   )rB   ro   )rB   r   )rB   rt   )rB   r   )rB   r>   )rB   r   )rB   r   )rB   r   )rB   r   )rB   r   )r   r   rB   r=   )"r%   r&   r'   r(   r   r)   rH   rO   rS   rY   r[   r_   rF   classmethodrn   rq   propertyre   rb   r}   r   r   r   rc   r   rd   r   r   r   r   r   rg   rh   r   r"   r*   r+   r-   r-   D   s        I"  9			""""			%%%%????55558888   
 
 
 
3 3 3 3
C C C C& & & &   < < < <    [&
 
 
 
 ? ? ? X?    X B B B XB 2 2 2 X2 	 	 	 X	 	 	 	 X	 K K K XK + + + X+$ " " " X"        X     X    X ' ' ' X' 	 	 	 X	 2 2 2 X2 | | | X|D D D D D Dr*   r-   c                       e Zd ZU dZdZerded<   ded<   ded<   ded	<   d fdZddZd fdZ	e
e
e
dddZed d            Z xZS )!r   a  Represents your Discord user.

    .. container:: operations

        .. describe:: x == y

            Checks if two users are equal.

        .. describe:: x != y

            Checks if two users are not equal.

        .. describe:: hash(x)

            Return the user's hash.

        .. describe:: str(x)

            Returns the user's handle (e.g. ``name`` or ``name#discriminator``).

    Attributes
    -----------
    name: :class:`str`
        The user's username.
    id: :class:`int`
        The user's unique ID.
    discriminator: :class:`str`
        The user's discriminator. This is a legacy concept that is no longer used.
    global_name: Optional[:class:`str`]
        The user's global nickname, taking precedence over the username in display.

        .. versionadded:: 2.3
    bot: :class:`bool`
        Specifies if the user is a bot account.
    system: :class:`bool`
        Specifies if the user is a system user (i.e. represents Discord officially).

        .. versionadded:: 1.3

    verified: :class:`bool`
        Specifies if the user's email is verified.
    locale: Optional[:class:`str`]
        The IETF language tag used to identify the language the user is using.
    mfa_enabled: :class:`bool`
        Specifies if the user has MFA turned on and working.
    )locale_flagsverifiedmfa_enabled__weakref__r=   r   r<   r   r   r#   r   r?   r   r@   UserPayloadrB   rC   c               N    t                                          ||           d S )Nr   )superrH   )rG   r?   r@   	__class__s      r+   rH   zClientUser.__init__  s&    u400000r*   r;   c                h    d| j          d| j        d| j        d| j         d| j         d| j         dS )Nz<ClientUser id=rJ   rK   rL   z
 verified=z mfa_enabled=rM   )r$   r.   r0   r4   r   r   rN   s    r+   rO   zClientUser.__repr__  sx    Xdg X XTY X XtGW X XHX X(,X XDHDTX X X	
r*   c                    t                                          |           |                    dd          | _        |                    d          | _        |                    dd          | _        |                    dd          | _        d S )Nr   Fr   flagsr   r   )r   rF   ri   r   r   r   r   )rG   r@   r   s     r+   rF   zClientUser._update  sr    U33hhx((hhw**88M599r*   )ra   rb   rc   ra   rb   Optional[bytes]rc   c               (  K   i }|t           ur||d<   |t           ur|t          |          |d<   nd|d<   |t           ur|t          |          |d<   nd|d<   | j        j                            |           d{V }t          | j        |          S )aV  |coro|

        Edits the current profile of the client.

        .. note::

            To upload an avatar, a :term:`py:bytes-like object` must be passed in that
            represents the image being uploaded. If this is done through a file
            then the file must be opened via ``open('some_filename', 'rb')`` and
            the :term:`py:bytes-like object` is given through the use of ``fp.read()``.


        .. versionchanged:: 2.0
            The edit is no longer in-place, instead the newly edited client user is returned.

        .. versionchanged:: 2.0
            This function will now raise :exc:`ValueError` instead of
            ``InvalidArgument``.

        Parameters
        -----------
        username: :class:`str`
            The new username you wish to change to.
        avatar: Optional[:class:`bytes`]
            A :term:`py:bytes-like object` representing the image to upload.
            Could be ``None`` to denote no avatar.
            Only image formats supported for uploading are JPEG, PNG, GIF, and WEBP.
        banner: Optional[:class:`bytes`]
            A :term:`py:bytes-like object` representing the image to upload.
            Could be ``None`` to denote no banner.
            Only image formats supported for uploading are JPEG, PNG, GIF and WEBP.

            .. versionadded:: 2.4

        Raises
        ------
        HTTPException
            Editing your profile failed.
        ValueError
            Wrong image format passed for ``avatar``.

        Returns
        ---------
        :class:`ClientUser`
            The newly edited client user.
        ra   Nrb   rc   r   )r   r   r7   httpedit_profiler   )rG   ra   rb   rc   payloadr@   s         r+   editzClientUser.edit  s      b #%7"""*GJ  !$9&$A$A!!$(!  !$9&$A$A!!$(!"&+"2"?"?"H"HHHHHHH$7777r*   List[Guild]c                4    t          | j        j                  S )List[:class:`Guild`]: The guilds that the user shares with the client.

        .. note::

            This will only return mutual guilds within the client's internal cache.

        .. versionadded:: 1.7
        )listr7   guildsrN   s    r+   mutual_guildszClientUser.mutual_guilds  s     DK&'''r*   )r?   r   r@   r   rB   rC   r   )r@   r   rB   rC   )ra   r;   rb   r   rc   r   rB   r   rB   r   )r%   r&   r'   __doc__r(   r   r)   rH   rO   rF   r   r   r   r   __classcell__)r   s   @r+   r   r   k  s        - -^ OI 1 1 1 1 1 1
 
 
 
: : : : : : ")GgnB8 B8 B8 B8 B8 B8H 	( 	( 	( X	( 	( 	( 	( 	(r*   r   c                  ^    e Zd ZdZdZddZddZedd	            Zedd            Z	ddZ
dS )r   a  Represents a Discord user.

    .. container:: operations

        .. describe:: x == y

            Checks if two users are equal.

        .. describe:: x != y

            Checks if two users are not equal.

        .. describe:: hash(x)

            Return the user's hash.

        .. describe:: str(x)

            Returns the user's handle (e.g. ``name`` or ``name#discriminator``).

    Attributes
    -----------
    name: :class:`str`
        The user's username.
    id: :class:`int`
        The user's unique ID.
    discriminator: :class:`str`
        The user's discriminator. This is a legacy concept that is no longer used.
    global_name: Optional[:class:`str`]
        The user's global nickname, taking precedence over the username in display.

        .. versionadded:: 2.3
    bot: :class:`bool`
        Specifies if the user is a bot account.
    system: :class:`bool`
        Specifies if the user is a system user (i.e. represents Discord officially).
    )r   rB   r;   c           	     H    d| j          d| j        d| j        d| j         d	S )Nz	<User id=rJ   rK   rL   rM   )r$   r.   r0   r4   rN   s    r+   rO   zUser.__repr__.  s6    h47hh$)hhDDThh]a]ehhhhr*   r   c                >   K   |                                   d {V }|S rE   )	create_dm)rG   chs     r+   _get_channelzUser._get_channel1  s,      >>########	r*   Optional[DMChannel]c                @    | j                             | j                  S )zOptional[:class:`DMChannel`]: Returns the channel associated with this user if it exists.

        If this returns ``None``, you can create a DM channel by calling the
        :meth:`create_dm` coroutine function.
        )r7   _get_private_channel_by_userr$   rN   s    r+   
dm_channelzUser.dm_channel5  s     {77@@@r*   r   c                X      fd j         j                                        D             S )r   c                H    g | ]}|                     j                  |S r"   )
get_memberr$   )r   guildrG   s     r+   r   z&User.mutual_guilds.<locals>.<listcomp>H  s0    ]]]%5CSCSTXT[C\C\]]]]r*   )r7   _guildsvaluesrN   s   `r+   r   zUser.mutual_guilds>  s1     ^]]]4;#6#=#=#?#?]]]]r*   c                   K   | j         }||S | j        }|j                            | j                   d{V }|                    |          S )a
  |coro|

        Creates a :class:`DMChannel` with this user.

        This should be rarely called, as this is done transparently for most
        people.

        Returns
        -------
        :class:`.DMChannel`
            The channel that was created.
        N)r   r7   r   start_private_messager$   add_dm_channel)rG   foundr?   r@   s       r+   r   zUser.create_dmJ  s^       L',z'G'G'P'P!P!P!P!P!P!P##D)))r*   Nr   )rB   r   )rB   r   r   )r%   r&   r'   r   r(   rO   r   r   r   r   r   r"   r*   r+   r   r     s        $ $L !Ii i i i    A A A XA 	^ 	^ 	^ X	^* * * * * *r*   r   )9r   
__future__r   typingr   r   r   r   r   r	   discord.abcdiscordr   r   r   r   enumsr   r   r   utilsr   r   r   r   rg   r   collectibler   typing_extensionsr   r   channelr   r   r   r   r   r?   r   types.channelDMChannelPayload
types.userr   PartialUserPayloadr   r   r   PrimaryGuildPayloadr   UserCollectiblesPayload__all__r!   r-   r   abcMessageabler"   r*   r+   <module>r      s   0 # " " " " " B B B B B B B B B B B B B B B B                             " " " " " " T T T T T T T T T T T T ' ' ' ' ' ' $ $ $ $ $ $ &&&&&&!!!!!!""""""      &&&&&&<<<<<<                    
dD dD dD dD dDx dD dD dDN	W( W( W( W( W( W( W( W(tX* X* X* X* X*8W[, X* X* X* X* X*r*   