
    cjh                    &   d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
mZmZmZ ddlZddlmZ ddlmZmZ dd	lmZ dd
lmZ ddl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$m%Z% ddlm&Z& dZ'e
r_ddl(m)Z) ddl*m+Z+m,Z,m-Z- ddlm.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z; ddl9m<Z= ddl9m>Z? ddl@m$ZA ddlBmCZD ddlBmEZF ee-e,f   ZG G d  d!      ZEd" ZH ed#d$%      ZIeH G d& d$ejP                  j                  e%             Z:y)'ae  
The MIT License (MIT)

Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development

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.
    )annotationsN)
attrgetter)TYPE_CHECKINGAnyTypeVarUnion   )utils)ActivityTypescreate_activity)Asset)Colour)Statustry_enum)MemberFlags)Object)Permissions)BaseUserUser_UserTag)MISSING)
VoiceStateMember)	Snowflake)	DMChannelStageChannelVoiceChannel)PublicUserFlags)Guild)Message)Role)ConnectionState)PartialPresenceUpdate)r   )MemberWithUser)UserWithMember)r   )GuildVoiceState)r   c                  @    e Zd ZdZdZdd	 	 	 ddZ	 	 	 	 ddZd	dZy)
r   a  Represents a Discord user's voice state.

    Attributes
    ----------
    deaf: :class:`bool`
        Indicates if the user is currently deafened by the guild.
    mute: :class:`bool`
        Indicates if the user is currently muted by the guild.
    self_mute: :class:`bool`
        Indicates if the user is currently muted by their own accord.
    self_deaf: :class:`bool`
        Indicates if the user is currently deafened by their own accord.
    self_stream: :class:`bool`
        Indicates if the user is currently streaming via 'Go Live' feature.

        .. versionadded:: 1.3

    self_video: :class:`bool`
        Indicates if the user is currently broadcasting video.
    suppress: :class:`bool`
        Indicates if the user is suppressed from speaking.

        Only applies to stage channels.

        .. versionadded:: 1.7

    requested_to_speak_at: Optional[:class:`datetime.datetime`]
        An aware datetime object that specifies the date and time in UTC that the member
        requested to speak. It will be ``None`` if they are not requesting to speak
        anymore or have been accepted to speak.

        Only applicable to stage channels.

        .. versionadded:: 1.7

    afk: :class:`bool`
        Indicates if the user is currently in the AFK channel in the guild.
    channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
        The voice channel that the user is currently connected to. ``None`` if the user
        is not currently in a voice channel.
    )
session_iddeafmute	self_muteself_stream
self_video	self_deafafkchannelrequested_to_speak_atsuppressN)r0   c               T    |j                  d      | _        | j                  ||       y )Nr(   )getr(   _updateselfdatar0   s      A/var/www/html/venv/lib/python3.12/site-packages/discord/member.py__init__zVoiceState.__init__   s"      $xx5T7#    c                   |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        |j                  dd      | _        t        j                  |j                  d	            | _        || _        y )
Nr+   Fr.   r,   r-   r2   r*   r)   request_to_speak_timestamp)r4   r+   r.   r,   r-   r/   r*   r)   r2   r
   
parse_timer1   r0   r6   s      r9   r5   zVoiceState._update   s    
  $xxU;#xxU;!%-!? $u =*e4((651	((651	"hhz59?D?O?OHH12@
" 29r;   c                   d| j                   fd| j                  fd| j                  fd| j                  fd| j                  fd| j
                  fg}dj                  d |D              }d	| j                  j                   d| d
S )Nr+   r.   r,   r2   r1   r0    c              3  &   K   | ]	  }d |z    yw)z%s=%rN ).0ts     r9   	<genexpr>z&VoiceState.__repr__.<locals>.<genexpr>   s     414s   <>)	r+   r.   r,   r2   r1   r0   join	__class____name__)r7   attrsinners      r9   __repr__zVoiceState.__repr__   s    $..)$..)D,,-'$d&@&@A%
 4e444>>**+1UG155r;   )r8   z*VoiceStatePayload | GuildVoiceStatePayloadr0   VocalGuildChannel | Nonereturnstr)rJ   
__module____qualname____doc__	__slots__r:   r5   rM   rB   r;   r9   r   r   H   sI    (TI$ -1	$ 9$ *	$989 *9$
6r;   r   c                   t        j                  t        j                  j	                         t
        j                  j	                               D ]  \  }|j                  d      r|| j                  v r't        d      s+t        d|       }t        | |t        |d| d             ^fd} ||      } t        j                        |      }t        | ||        | S )N___annotations__z_user.zEquivalent to :attr:`User.`)docc                X     t        j                        r fd}n fd} |_        |S )Nc                X   K    t        | j                        |i | d {   S 7 wNgetattr_userr7   argskwargsxs      r9   generalz8flatten_user.<locals>.generate_function.<locals>.general   s*     %;WTZZ%;T%LV%LLLLs    *(*c                <     t        | j                        |i |S r]   r^   ra   s      r9   re   z8flatten_user.<locals>.generate_function.<locals>.general   s     5wtzz15tFvFFr;   )inspectiscoroutinefunctionrJ   )rd   re   values   ` r9   generate_functionz'flatten_user.<locals>.generate_function   s,    ..u5M
G $% r;   )	itertoolschainr   __dict__itemsr   
startswithhasattrr   setattrpropertyr
   copy_doc)clsattrgetterrj   funcri   s        @r9   flatten_userrx      s     !4==#6#6#8 (%e ??3 3<< u/0&0FT8F2LTFRS0TU %T*D(5>>%(.DCt$Q(%T Jr;   Mr   )boundc            
         e Zd ZU dZdZerWd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<   ej                  Zded<   ded<   ded<   ded<   ded<   ded<   	 	 	 	 	 	 dQdZ	dRdZ
dRdZdSd ZdTd!ZedUd"       ZdVd#Ze	 	 	 	 	 	 	 	 	 	 dWd$       ZedXd%       Zd& ZdVd'Z	 	 	 	 	 	 dYd(ZdZd)Zed[d*       ZedRd+       Zej4                  d\d,       Zed[d-       Zed[d.       Zed[d/       Zed]d0       Zd^d1Zed_d2       Z ed_d3       Z!ed`d4       Z"edRd5       Z#edRd6       Z$edad7       Z%edbd8       Z&edcd9       Z'ddd:Z(eded;       Z)edfd<       Z*edgd=       Z+ed^d>       Z,d?d?d@	 	 	 	 	 dhdAZ-d?dBdidCZ.d?dBdidDZ/e0e0e0e0e0e0d?e0e0dE		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 djdFZ1d?dB	 	 	 	 	 dkdGZ2d?dB	 	 	 	 	 dldHZ3d?dBdidIZ4dmdJZ5d?dB	 	 	 	 	 dndKZ6d?dLdM	 	 	 	 	 	 	 dodNZ7d?dLdM	 	 	 	 	 	 	 dodOZ8dpdPZ9y?)qr   a&  Represents a Discord member to a :class:`Guild`.

    This implements a lot of the functionality of :class:`User`.

    .. container:: operations

        .. describe:: x == y

            Checks if two members are equal.
            Note that this works with :class:`User` instances too.

        .. describe:: x != y

            Checks if two members are not equal.
            Note that this works with :class:`User` instances too.

        .. describe:: hash(x)

            Returns the member's hash.

        .. describe:: str(x)

            Returns the member's name with the discriminator or global_name.

    Attributes
    ----------
    joined_at: Optional[:class:`datetime.datetime`]
        An aware datetime object that specifies the date and time in UTC that the member joined the guild.
        If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be ``None``.
    activities: Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]
        The activities that the user is currently doing.

        .. note::

            Due to a Discord API limitation, a user's Spotify activity may not appear
            if they are listening to a song with a title longer
            than 128 characters.

    guild: :class:`Guild`
        The guild that the member belongs to.
    nick: Optional[:class:`str`]
        The guild specific nickname of the user.
    pending: :class:`bool`
        Whether the member is pending member verification.

        .. versionadded:: 1.6
    premium_since: Optional[:class:`datetime.datetime`]
        An aware datetime object that specifies the date and time in UTC when the member used their
        "Nitro boost" on the guild, if available. This could be ``None``.
    communication_disabled_until: Optional[:class:`datetime.datetime`]
        An aware datetime object that specifies the date and time in UTC when the member will be removed from timeout.

        .. versionadded:: 2.0
    flags: :class:`MemberFlags`
        Extra attributes of the member.

        .. versionadded:: 2.6
    )_roles	joined_atpremium_since
activitiesguildpendingnick_client_statusr`   _state_avatarcommunication_disabled_untilflagsrQ   nameintiddiscriminatorboolbotsystemzdatetime.datetime
created_atr   default_avatarAsset | NoneavatarzDMChannel | None
dm_channelzlist[Guild]mutual_guildsr   public_flagsbannerzColour | Noneaccent_coloraccent_colourdatetime.datetime | Noner   c                  || _         |j                  |d         | _        || _        t	        j
                  |j                  d            | _        t	        j
                  |j                  d            | _        t	        j                  t        t        |d               | _        d di| _        d| _        |j                  dd       | _        |j                  dd	      | _        |j                  d
      | _        t	        j
                  |j                  d            | _        t'        j(                  |j                  dd            | _        y )Nuserr}   r~   rolesofflinerB   r   r   Fr   r   r   r   )r   
store_userr`   r   r
   r>   r4   r}   r~   SnowflakeListmapr   r|   r   r   r   r   r   r   r   _from_valuer   )r7   r8   r   states       r9   r:   zMember.__init__9  s    (- ++DL9
!
383C3CHH[!4
 8=7G7GHH_%8
 ,1+>+>s3W?V+W6:I5F57 $ 6	!XXi7#'88H#5FKFVFVHH34G
) #."9"9$((7A:N"O
r;   c                ,    t        | j                        S r]   )rQ   r`   r7   s    r9   __str__zMember.__str__P  s    4::r;   c                   | j                   j                  r| j                  od| j                   j                   d| j                   j                  d| j                  d| j                   j
                   d| j                  d| j                  dS d| j                   j                   d| j                   j                  d| j                   j
                   d| j                  d| j                  dS d| j                   j                   d| j                   j                  d| j                   j                  d| j                   j
                   d| j                  d| j                  dS )	Nz<Member id=z name=z global_name=z bot=z nick=z guild=rG   z discriminator=)	r`   is_migratedglobal_namer   r   r   r   r   r   r   s    r9   rM   zMember.__repr__S  s2   ::!!+::==/

/B-PTP`P`OcDJJNN+6$))gdjj^STV::==/

/BDJJNN+6$))gdjj^STV::==/

':/$**JbJbIeDJJNN#6$))gdjj^1N	
r;   c                X    t        |t              xr |j                  | j                  k(  S r]   )
isinstancer   r   )r7   others     r9   __eq__zMember.__eq__g  s!    %*Buxx477/BBr;   c                ,    t        | j                        S r]   )hashr`   r   s    r9   __hash__zMember.__hash__j  s    DJJr;   c               ~    |j                   }|j                         |d<    | ||j                  |j                        S )Nr   r8   r   r   )author_to_minimal_user_jsonr   r   )rt   messager8   r   s       r9   _from_messagezMember._from_messagem  s4    335VGMMHHr;   c                Z   t        j                  |j                  d            | _        t        j                  |j                  d            | _        t        j
                  t        t        |d               | _        |j                  dd       | _	        |j                  dd      | _
        y )Nr}   r~   r   r   r   F)r
   r>   r4   r}   r~   r   r   r   r|   r   r   r7   r8   s     r9   _update_from_messagezMember._update_from_messages  sz    ))$((;*?@"--dhh.GH))#c4=*ABHHVT*	xx	51r;   c                   	 |j                  d      }||d<    | |||      S # t        $ r |j                  |      cY S w xY w)Nmemberr   r   )popKeyErrorcreate_user)rt   r8   r   r   member_datas        r9   _try_upgradezMember._try_upgradez  sS    	C((8,K #'KKuEBB	  	+$$T**	+s   # A A c                (   | j                  |       }t        j                  |j                  d      |_        |j                  |_        |j
                  |_        |j                  j                         |_        |j                  |_        |j                  |_	        |j                  |_
        |j                  |_        |j                  |_        |j                  |_        |j                  |_        |j                  |_        |j                   |_        |S )NT)	is_sorted)__new__r
   r   r|   r}   r~   r   copyr   r   r   r   r   r   r   r   r`   )rt   r   r7   s      r9   _copyzMember._copy  s    ++c"))&--4H))#11$3388:\\
KK	~~ ++mm~~,2,O,O)\\
 \\
r;   c                B   K   | j                          d {   }|S 7 wr]   )	create_dm)r7   chs     r9   _get_channelzMember._get_channel  s     >>##	 $s   c                   	 |d   | _         	 |d   | _        t        j                  |j                  d            | _        t        j                  t        t        |d               | _
        |j                  d      | _        t        j                  |j                  d            | _        t        j                  |j                  dd            | _        y # t        $ r Y w xY w# t        $ r Y w xY w)	Nr   r   r~   r   r   r   r   r   )r   r   r   r
   r>   r4   r~   r   r   r   r|   r   r   r   r   r   r   s     r9   r5   zMember._update  s    	VDI		?DL #--dhh.GH))#c4=*ABxx),1,<,<HH34-
) !,,TXXgq-AB
  		
  		s"   
C 
C$ 	C! C!$	C0/C0c                   t        t        t        |d               | _        |j	                  di       j                         D ci c].  \  }}t        j                  |      t        j                  |      0 c}}| _        t        j                  |d         | j                  d <   t        |      dkD  r| j                  |      S y c c}}w )Nr   client_statusstatusr	   )tupler   r   r   r4   rn   sysinternr   len_update_inner_user)r7   r8   r   keyri   s        r9   _presence_updatezMember._presence_update  s      OT,5G HIAE/[]A^AdAdAf
3=3CJJsOSZZ..
 %(JJtH~$>D!t9q=**400
s   3Cc                   | j                   }|j                  |j                  |j                  |j                  |j
                  f}|d   |d   |d   |j                  dd       xs d |j                  dd      f}||k7  rDt        j                  | j                         }|\  |_        |_        |_        |_        |_        ||fS y )Nusernamer   r   r   r   r   )	r`   r   r   r   r   _public_flagsr4   r   r   )r7   r   uoriginalmodified	to_returns         r9   r   zMember._update_inner_user  s    JJFFAIIqqW N!HH]D)1THH^Q'
 x

4::.I 	 a<  r;   c                <    t        t        | j                  d         S )znThe member's overall status.
        If the value is unknown, then it will be a :class:`str` instead.
        N)r   r   r   r   s    r9   r   zMember.status  s    
  3 3D 9::r;   c                     | j                   d   S )zVThe member's overall status as a string value.

        .. versionadded:: 1.5
        Nr   r   s    r9   
raw_statuszMember.raw_status  s     ""4((r;   c                4    t        |      | j                  d <   y r]   )rQ   r   )r7   ri   s     r9   r   zMember.status  s     %(JD!r;   c                V    t        t        | j                  j                  dd            S )z6The member's status on a mobile device, if applicable.mobiler   r   r   r   r4   r   s    r9   mobile_statuszMember.mobile_status  s$      3 3 7 7) LMMr;   c                V    t        t        | j                  j                  dd            S )z9The member's status on the desktop client, if applicable.desktopr   r   r   s    r9   desktop_statuszMember.desktop_status  s$      3 3 7 7	9 MNNr;   c                V    t        t        | j                  j                  dd            S )z5The member's status on the web client, if applicable.webr   r   r   s    r9   
web_statuszMember.web_status  s$      3 3 7 7y IJJr;   c                .    | j                   j                  S )z(The member's global name, if applicable.)r`   r   r   s    r9   r   zMember.global_name  s     zz%%%r;   c                    d| j                   v S )zKA helper function that determines if a member is active on a mobile device.r   r   r   s    r9   is_on_mobilezMember.is_on_mobile  s    4....r;   c                    | j                   dd }t        |      D ]&  }|j                  j                  s|j                  c S  t	        j
                         S )a  A property that returns a colour denoting the rendered colour
        for the member. If the default colour is the one rendered then an instance
        of :meth:`Colour.default` is returned.

        There is an alias for this named :attr:`color`.
        r	   N)r   reversedcolourri   r   default)r7   r   roles      r9   r   zMember.colour
  sN     

12
 UO 	#D{{  {{"	# ~~r;   c                    | j                   S )zA property that returns a color denoting the rendered color for
        the member. If the default color is the one rendered then an instance of :meth:`Colour.default`
        is returned.

        There is an alias for this named :attr:`colour`.
        )r   r   s    r9   colorzMember.color  s     {{r;   c                    g }| j                   }| j                  D ]'  }|j                  |      }|s|j                  |       ) |j                  |j                         |j                          |S )zA :class:`list` of :class:`Role` that the member belongs to. Note
        that the first element of this list is always the default '@everyone'
        role.

        These roles are sorted by their position in the role hierarchy.
        )r   r|   get_roleappenddefault_rolesort)r7   resultgrole_idr   s        r9   r   zMember.roles'  sb     JJ{{ 	$G::g&Dd#	$ 	ann%r;   c                6    d| j                   j                   dS )z7Returns a string that allows you to mention the member.z<@rG   )r`   r   r   s    r9   mentionzMember.mention9  s     DJJMM?!$$r;   c                R    | j                   xs | j                  xs | j                  S )z}Returns the user's display name.
        This will either be their guild specific nickname, global name or username.
        )r   r   r   r   s    r9   display_namezMember.display_name>  s"    
 yy9D,,9		9r;   c                z    | j                   xs. | j                  j                  xs | j                  j                  S )zReturns the member's display avatar.

        For regular members this is just their avatar, but
        if they have a guild specific avatar then that
        is returned instead.

        .. versionadded:: 2.0
        )guild_avatarr`   r   r   r   s    r9   display_avatarzMember.display_avatarE  s.       RDJJ$5$5R9R9RRr;   c                    | j                   yt        j                  | j                  | j                  j
                  | j
                  | j                         S )zReturns an :class:`Asset` for the guild avatar
        the member has. If unavailable, ``None`` is returned.

        .. versionadded:: 2.0
        N)r   r   _from_guild_avatarr   r   r   r   s    r9   r  zMember.guild_avatarQ  sA     <<''KK
 	
r;   c                :    | j                   r| j                   d   S y)a  Returns the primary
        activity the user is currently doing. Could be ``None`` if no activity is being done.

        .. note::

            Due to a Discord API limitation, this may be ``None`` if
            the user is listening to a song on Spotify with a title longer
            than 128 characters.

        .. note::

            A user may have multiple activities, these can be accessed under :attr:`activities`.
        r   N)r   r   s    r9   activityzMember.activity^  s     ????1%% r;   c                     |j                   -|j                   j                   j                   j                  k7  ry j                  j                  |      ryt	         fd|j
                  D              S )a>  Checks if the member 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 member is mentioned in the message.
        FTc              3  h   K   | ])  }j                   j                  |j                         + y wr]   )r|   hasr   )rC   r   r7   s     r9   rE   z&Member.mentioned_in.<locals>.<genexpr>  s"     N4;;??477+Ns   /2)r   r   r`   mentioned_inanyrole_mentions)r7   r   s   ` r9   r
  zMember.mentioned_inp  sW     == GMM$4$4

$E::""7+N8M8MNNNr;   c                    | j                   t        | j                        dk(  rj                  S t	        fd| j                  D              S )zReturns the member's highest role.

        This is useful for figuring where a member stands in the role
        hierarchy chain.
        r   c              3  \   K   | ]#  }j                  |      xs j                   % y wr]   )r   r   )rC   ridr   s     r9   rE   z"Member.top_role.<locals>.<genexpr>  s(     T5>>#&<%*<*<<Ts   ),)r   r   r|   r   max)r7   r   s    @r9   top_rolezMember.top_role  s@     

t{{q %%%TTTTr;   c                P   | j                   j                  | j                  k(  rt        j                         S t        j
                         }| j                  D ]+  }|xj                  |j                  j                  z  c_        - |j                  rt        j                         S |S )a  Returns the member's guild permissions.

        This only takes into consideration the guild permissions
        and not most of the implied permissions or any of the
        channel permission overwrites. For 100% accurate permission
        calculation, please use :meth:`abc.GuildChannel.permissions_for`.

        This does take into consideration guild ownership and the
        administrator implication.
        )
r   owner_idr   r   allnoner   ri   permissionsadministrator)r7   basers      r9   guild_permissionszMember.guild_permissions  s}     ::$'')??$$! 	.AJJ!-----J	. ??$$r;   c                `    | j                   j                  | j                  j                        S )z)Returns the member's current voice state.)r   _voice_state_forr`   r   r   s    r9   voicezMember.voice  s!     zz**4::==99r;   c                    | j                   duxrD | j                   t        j                  j                  t        j                  j                        kD  S )zPReturns whether the member is timed out.

        .. versionadded:: 2.0
        N)r   datetimenowtimezoneutcr   s    r9   	timed_outzMember.timed_out  sJ     --T9 ;11##H$5$5$9$9:;	
r;   N)delete_message_secondsreasonc               \   K   | j                   j                  | ||       d{    y7 w)zK|coro|

        Bans this member. Equivalent to :meth:`Guild.ban`.
        )r%  r$  N)r   ban)r7   r$  r%  s      r9   r'  z
Member.ban  s0      jjnn#9  
 	
 	
s   ",*,r%  c               Z   K   | j                   j                  | |       d{    y7 w)zO|coro|

        Unbans this member. Equivalent to :meth:`Guild.unban`.
        r(  N)r   unbanr7   r%  s     r9   r*  zMember.unban  s%     
 jjtF333   !+)+c               Z   K   | j                   j                  | |       d{    y7 w)zM|coro|

        Kicks this member. Equivalent to :meth:`Guild.kick`.
        r(  N)r   kickr+  s     r9   r.  zMember.kick  s"     
 jjood6o222r,  )	r   r*   deafenr2   r   voice_channelr%  r   bypass_verificationc       	          K   | j                   j                  }
| j                  j                  }| j                   j                  | j                  k(  }i }|t
        ur*|xs d}|r|
j                  |||       d{    n||d<   |t
        ur||d<   |t
        ur||d<   |t
        ur| j                  j                  j                  |d}|s| j                  rd|d<   |r|
j                  ||       d{    nV|s/t        j                  j                         j                         |d<   |
j                  || j                  |       d{    |t
        ur|xr |j                  |d	<   |t
        urt        d
 |D              |d<   |t
        ur||j                         |d<   n||d<   |	t
        ur?t!        j"                  | j$                  j&                        }|	|_        |j&                  |d<   |rJ |
j*                  || j                  fd|i| d{   }t-        || j                  | j                         S y7 7 N7 7 /w)a  |coro|

        Edits the member's data.

        Depending on the parameter passed, this requires different permissions listed below:

        +------------------------------+--------------------------------------+
        |   Parameter                  |              Permission              |
        +------------------------------+--------------------------------------+
        | nick                         | :attr:`Permissions.manage_nicknames` |
        +------------------------------+--------------------------------------+
        | mute                         | :attr:`Permissions.mute_members`     |
        +------------------------------+--------------------------------------+
        | deafen                       | :attr:`Permissions.deafen_members`   |
        +------------------------------+--------------------------------------+
        | roles                        | :attr:`Permissions.manage_roles`     |
        +------------------------------+--------------------------------------+
        | voice_channel                | :attr:`Permissions.move_members`     |
        +------------------------------+--------------------------------------+
        | communication_disabled_until | :attr:`Permissions.moderate_members` |
        +------------------------------+--------------------------------------+
        | bypass_verification          | See note below                       |
        +------------------------------+--------------------------------------+

        .. note::

            `bypass_verification` may be edited under three scenarios:

            - Client has :attr:`Permissions.manage_guild`

            - Client has :attr:`Permissions.manage_roles`

            - Client has ALL THREE of :attr:`Permissions.moderate_members`, :attr:`Permissions.kick_members`, and :attr:`Permissions.ban_members`

        All parameters are optional.

        .. versionchanged:: 1.1
            Can now pass ``None`` to ``voice_channel`` to kick a member from voice.

        .. versionchanged:: 2.0
            The newly member is now optionally returned, if applicable.

        Parameters
        ----------
        nick: Optional[:class:`str`]
            The member's new nickname. Use ``None`` to remove the nickname.
        mute: :class:`bool`
            Indicates if the member should be guild muted or un-muted.
        deafen: :class:`bool`
            Indicates if the member should be guild deafened or un-deafened.
        suppress: :class:`bool`
            Indicates if the member should be suppressed in stage channels.

            .. versionadded:: 1.7

        roles: List[:class:`Role`]
            The member's new list of roles. This *replaces* the roles.
        voice_channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
            The voice channel to move the member to.
            Pass ``None`` to kick them from voice.
        reason: Optional[:class:`str`]
            The reason for editing this member. Shows up on the audit log.
        communication_disabled_until: Optional[:class:`datetime.datetime`]
            Temporarily puts the member in timeout until this time. If the value is ``None``, then the user is removed
            from timeout.

            .. versionadded:: 2.0
        bypass_verification: Optional[:class:`bool`]
            Indicates if the member should bypass the guild's verification requirements.

            .. versionadded:: 2.6

        Returns
        -------
        Optional[:class:`.Member`]
            The newly updated member, if applicable. This is only returned
            when certain fields are updated.

        Raises
        ------
        Forbidden
            You do not have the proper permissions to the action requested.
        HTTPException
            The operation failed.
         r(  Nr   r)   r*   )
channel_idr2   r=   r4  c              3  4   K   | ]  }|j                     y wr]   r   )rC   r  s     r9   rE   zMember.edit.<locals>.<genexpr>d  s     $9aQTT$9s   r   r   r   r%  r   )r   httpr   r   self_idr   change_my_nicknamer  r0   r   edit_my_voice_stater  utcnow	isoformatedit_voice_stater   r   r   r   ri   bypasses_verificationedit_memberr   )r7   r   r*   r/  r2   r   r0  r%  r   r1  r7  guild_idmepayloadvoice_state_payloadr   r8   s                    r9   editzMember.edit  s@    D {{::==[[  DGG+"$w:2D--hV-LLL"& $GFOw"GFO7""jj0033$#
 488DH#$@A..x9LMMM ))002<<> ((DE ++Hdgg?RSSS'$1$Fm6F6FGL!$$95$99GG'w6+70::< 67 ;W67g-++DJJ,<,<=E*=E'${{GG)))(DGGVFVgVVDt4::T[[II _ M( N T, WsK   A9I
;I <A9I
5I6AI
ICI
I(I
I
I
I
c               F   K   | j                  ||       d{    y7 w)a  |coro|

        Applies a timeout to a member in the guild until a set datetime.

        You must have the :attr:`~Permissions.moderate_members` permission to timeout a member.

        Parameters
        ----------
        until: :class:`datetime.datetime`
            The date and time to timeout the member for. If this is ``None`` then the member is removed from timeout.
        reason: Optional[:class:`str`]
            The reason for doing this action. Shows up on the audit log.

        Raises
        ------
        Forbidden
            You do not have permissions to timeout members.
        HTTPException
            An error occurred doing the request.
        r   r%  NrD  )r7   untilr%  s      r9   timeoutzMember.timeoutw  s     . iiU6iJJJ   !!c                  K   | j                  t        j                  j                  t        j                  j                        |z   |       d{    y7 w)a  |coro|

        Applies a timeout to a member in the guild for a set duration. A shortcut method for :meth:`~.timeout`, and
        equivalent to ``timeout(until=datetime.utcnow() + duration, reason=reason)``.

        You must have the :attr:`~Permissions.moderate_members` permission to
        timeout a member.

        Parameters
        ----------
        duration: :class:`datetime.timedelta`
            The duration to timeout the member for.
        reason: Optional[:class:`str`]
            The reason for doing this action. Shows up on the audit log.

        Raises
        ------
        Forbidden
            You do not have permissions to timeout members.
        HTTPException
            An error occurred doing the request.
        r(  N)rI  r  r   r!  r"  )r7   durationr%  s      r9   timeout_forzMember.timeout_for  sJ     2 ll!!("3"3"7"788CF  
 	
 	
s   AAAAc               F   K   | j                  d|       d{    y7 w)a^  |coro|

        Removes the timeout from a member.

        You must have the :attr:`~Permissions.moderate_members` permission to
        remove the timeout.

        This is equivalent to calling :meth:`~.timeout` and passing ``None`` to the ``until`` parameter.

        Parameters
        ----------
        reason: Optional[:class:`str`]
            The reason for doing this action. Shows up on the audit log.

        Raises
        ------
        Forbidden
            You do not have permissions to remove the timeout.
        HTTPException
            An error occurred doing the request.
        NrF  rG  r+  s     r9   remove_timeoutzMember.remove_timeout  s     , iiT&iIIIrJ  c                  K   | j                   j                  j                  t        j                  j	                         j                         d}| j                  j                  | j                  k7  rSd|d<   | j                  j                  j                  | j                  j                  | j                  |       d{    y| j                  j                  j                  | j                  j                  |       d{    y7 H7 w)a  |coro|

        Request to speak in the connected channel.

        Only applies to stage channels.

        .. note::

            Requesting members that are not the client is equivalent
            to :attr:`.edit` providing ``suppress`` as ``False``.

        .. versionadded:: 1.7

        Raises
        ------
        Forbidden
            You do not have the proper permissions to the action requested.
        HTTPException
            The operation failed.
        )r4  r=   Fr2   N)r  r0   r   r  r;  r<  r   r8  r7  r=  r   r:  )r7   rB  s     r9   request_to_speakzMember.request_to_speak  s     , **,,//*2*;*;*B*B*D*N*N*P

 ;;$'')"'GJ++""33DJJMM477GTTT++""66tzz}}gNNN UNs%   B>D D	ADDDDc               F   K   | j                  ||       d{    y7 w)a  |coro|

        Moves a member to a new voice channel (they must be connected first).

        You must have the :attr:`~Permissions.move_members` permission to
        use this.

        This raises the same exceptions as :meth:`edit`.

        .. versionchanged:: 1.1
            Can now pass ``None`` to kick a member from voice.

        Parameters
        ----------
        channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
            The new voice channel to move the member to.
            Pass ``None`` to kick them from voice.
        reason: Optional[:class:`str`]
            The reason for doing this action. Shows up on the audit log.
        )r0  r%  NrG  )r7   r0   r%  s      r9   move_tozMember.move_to  s     . iigfi===rJ  T)r%  atomicc               t  K   |sGt        j                  d | j                  dd |fD              }| j                  ||       d{    y| j                  j
                  j                  }| j                  j                  }| j                  }|D ]   } ||||j                  |       d{    " y7 m7 	w)a  |coro|

        Gives the member a number of :class:`Role`\s.

        You must have the :attr:`~Permissions.manage_roles` permission to
        use this, and the added :class:`Role`\s must appear lower in the list
        of roles than the highest role of the member.

        Parameters
        -----------
        \*roles: :class:`abc.Snowflake`
            An argument list of :class:`abc.Snowflake` representing a :class:`Role`
            to give to the member.
        reason: Optional[:class:`str`]
            The reason for adding these roles. Shows up on the audit log.
        atomic: :class:`bool`
            Whether to atomically add roles. This will ensure that multiple
            operations will always be applied regardless of the current
            state of the cache.

        Raises
        -------
        Forbidden
            You do not have permissions to add these roles.
        HTTPException
            Adding roles failed.
        c              3  V   K   | ]!  }|D ]  }t        |j                           # yw)r6  N)r   r   )rC   sr  s      r9   rE   z#Member.add_roles.<locals>.<genexpr>  s1      &$%!&EF!$$&&s   ')r	   Nr   r%  r(  )	r
   _uniquer   rD  r   r7  add_roler   r   )	r7   r%  rT  r   	new_rolesreqr@  user_idr   s	            r9   	add_roleszMember.add_roles  s     >  &*.**QR.%)@& I )))F);;;++""++Czz}}HggG E(GTWWVDDDE < Es%   AB8B4A%B8,B6-B86B8c                  K   |sy| j                   dd D cg c]  }t        |j                         }}|D ](  }	 |j                  t        |j                               * | j                  ||       d{    y| j                  j                  j                  }| j                  j                  }| j                  }	|D ]   } |||	|j                  |       d{    " yc c}w # t        $ r Y w xY w7 7 w)a  |coro|

        Removes :class:`Role`\s from this member.

        You must have the :attr:`~Permissions.manage_roles` permission to
        use this, and the removed :class:`Role`\s must appear lower in the list
        of roles than the highest role of the member.

        Parameters
        -----------
        \*roles: :class:`abc.Snowflake`
            An argument list of :class:`abc.Snowflake` representing a :class:`Role`
            to remove from the member.
        reason: Optional[:class:`str`]
            The reason for removing these roles. Shows up on the audit log.
        atomic: :class:`bool`
            Whether to atomically remove roles. This will ensure that multiple
            operations will always be applied regardless of the current
            state of the cache.

        Raises
        -------
        Forbidden
            You do not have permissions to remove these roles.
        HTTPException
            Removing the roles failed.
        r	   Nr6  rX  r(  )
r   r   r   remove
ValueErrorrD  r   r7  remove_roler   )
r7   r%  rT  r   r  r[  r   r\  r@  r]  s
             r9   remove_roleszMember.remove_roles)  s     > 26**QR.AQ144AIA $$Vtww%78 )))F);;;++""..Czz}}HggG E(GTWWVDDDE B "  < EsQ   C>C&C>%C+ C>8C:9A%C>C<C>+	C74C>6C77C><C>c               r    | j                   j                  |      r| j                  j                  |      S dS )aV  Returns a role with the given ID from roles which the member has.

        .. versionadded:: 2.0

        Parameters
        ----------
        role_id: :class:`int`
            The ID to search for.

        Returns
        -------
        Optional[:class:`Role`]
            The role or ``None`` if not found in the member's roles.
        N)r|   r	  r   r   )r7   r   s     r9   r   zMember.get_roleX  s-     04{{w/Gtzz""7+QTQr;   )r8   MemberWithUserPayloadr   r   r   r"   rO   )r   r   rP   r   )rP   r   )rt   type[M]r   r    r8   MemberPayloadrP   ry   )r8   rg  rP   None)
rt   rf  r8   UserWithMemberPayloadr   r   r   r"   rP   zUser | M)rt   rf  r   ry   rP   ry   )r8   r#   r   UserPayloadrP   tuple[User, User] | None)r   rj  rP   rk  )rP   r   )ri   r   rP   rh  )rP   
str | None)rP   r   )rP   r   )rP   z
list[Role])rP   r   )rP   r   )rP   zActivityTypes | None)r   r    rP   r   )rP   r!   )rP   r   )rP   zVoiceState | None)r$  z
int | Noner%  rl  rP   rh  )r%  rl  rP   rh  )r   rl  r*   r   r/  r   r2   r   r   zlist[discord.abc.Snowflake]r0  rN   r%  rl  r   r   r1  zbool | NonerP   zMember | None)rH  r   r%  rl  rP   rh  )rL  zdatetime.timedeltar%  rl  rP   rh  )rP   rh  )r0   rN   r%  rl  rP   rh  )r   r   r%  rl  rT  r   rP   rh  )r   r   rP   zRole | None):rJ   rR   rS   rT   rU   r   rX   r   r   r:   r   rM   r   r   classmethodr   r   r   r   r   r5   r   r   rr   r   r   setterr   r   r   r   r   r   r   r   r   r   r  r  r  r
  r  r  r  r#  r'  r*  r.  r   rD  rI  rM  rO  rQ  rS  r^  rc  r   rB   r;   r9   r   r      s   9vI  		%%$$NN	""%%##$$&>>P,P5:PCRP.
(C  I I
2 CC $C 	C
 C 
C C   *C*)1<	! . ; ; ) ) ]]/ / N N O O K K & &/    $    " % % : : 	S 	S 

 

 & &"O* 
U 
U  0 : : 	
 	
 .2!	
 !+
 	

 

  37 4 26 3 # -429!AH+2[J [J 	[J
 [J [J +[J 0[J [J '?[J )[J 
[J| HLK-K:DK	K4 EI
*
7A
	
: <@ J0OB JN>/><F>	>4 7;4)E)E)3)EDH)E	)EX 7;4-E-E)3-EDH-E	-E^Rr;   )KrT   
__future__r   r  rg   rk   r   operatorr   typingr   r   r   r   discord.abcdiscordr3  r
   r  r   r   assetr   r   r   enumsr   r   r   r   objectr   r  r   r   r   r   r   r   __all__abcr   r0   r   r   r   r   r   r   r   r    r   r!   r   r"   types.activityr#   types.memberr   rg  r$   re  r%   ri  
types.userrj  types.voicer&   GuildVoiceStatePayloadr   VoiceStatePayloadVocalGuildChannelrx   ry   MessageablerB   r;   r9   <module>r     s   2 #    
  5 5   4   #   $ * * 
 >>& &55EE/F<lL89^6 ^6B+\ Cx  LRW[[$$h LR LRr;   