
    cjh             	         d Z ddlmZ ddlZddlZddlZddlmZmZm	Z	m
Z
mZ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 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& ddl'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2m3Z3 dZ4 ede3      Z5erddl6m6Z6 ddl7m8Z8 ddl9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@ ddlAmBZB ddlCmDZD ddlmEZE ddlmFZF ddlGmHZH dd lImJZJ dd!lKmLZLmMZMmNZN dd"lOmPZP dd#lQmRZR dd$lSmTZT dd%lUmVZW dd&lUmXZY dd'lUmZZZ dd(lUm(Z[ dd)l\m]Z] dd*l^m_Z_ ee?e@e>eTe;e=f   Z`ee`e<f   Zaed+e6f   Zbej                  Zcdd,	 	 	 dCd-Zdd.ecdddd/d0dd1	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dDd2Zee G d3 d+e             Zfe G d4 d5efe             Zge G d6 d7efe             Zh G d8 d9      Zi ed:d;      Zj G d< d;      ZX G d= d>      Zk G d? d@e      Zl G dA dB      Zmy)Eae  
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)
TYPE_CHECKINGAnyCallableIterableProtocolSequenceTypeVarUnionoverloadruntime_checkable   )utilsTyping)ChannelType)ClientExceptionInvalidArgument)File)MessageFlags)InviteHistoryIterator)AllowedMentions)PartialEmoji	_EmojiTag)PermissionOverwritePermissions)Role)ScheduledEvent)GuildStickerStickerItem)VoiceClientVoiceProtocol)	SnowflakeUserPrivateChannelGuildChannelMessageableConnectableMentionableT)bound)datetime)Asset)CategoryChannel	DMChannelGroupChannelPartialMessageableStageChannelTextChannelVoiceChannel)Client)Embed)InviteTarget)ChannelFlags)Guild)Member)MessageMessageReferencePartialMessage)Poll)ConnectionState)Thread)Channel)r(   )OverwriteType)r   )View)
ClientUserr%   reasonc               R   K   | D ]  }|j                  |       d {     y 7 w)NrG   )delete)messagesrH   ms      >/var/www/html/venv/lib/python3.12/site-packages/discord/abc.py_single_delete_strategyrN   o   s.       &hhfh%%%&%s   '%'d   FT)limitcheckbeforeafteraroundoldest_firstbulkrH   c                 K   |t         u rd }| j                  |||||      }	g }
d}t        t        j                         dz
  dz  dz
        dz  }|r| j                  nt
        }|	2 3 d {   }|dk(  r6|
d	d  } |||
       d {    d}t        j                  d       d {     ||      sM|j                  |k  rH|dk(  r|
d   j                  |
       d {    n|dk\  r|
| d  } |||
       d {    d}t
        }|dz  }|
j                  |       7 7 7 7 G7 +6 |dk\  r|
| d  } |||
       d {  7   |
S |dk(  r|
d   j                  |
       d {  7   |
S w)Nc                     yNT )rL   s    rM   <lambda>z(_purge_messages_helper.<locals>.<lambda>           )rP   rR   rS   rU   rT   r   i u g     @@l    0E*   rO   irG   r      )MISSINGhistoryinttimedelete_messagesrN   asynciosleepidrJ   append)channelrP   rQ   rR   rS   rT   rU   rV   rH   iteratorretcountminimum_timestrategymessage	to_deletes                   rM   _purge_messages_helperrr   v   s     !  H CE		&776AMQRVXXL*.w&&4KH!  gC<DE
I9V444E--"""W~::$z"gnnFn333!L	y888E.H


7- 5" 4 9! "2 zL	y000
 J	 
!"gnnFn+++Js   A%E2'D,+D",D,/E2D$E2&D&'9E2 D(!E2>D*?#E2"D,$E2&E2(E2*E2,E2E$E2*E-+E2c                       e Zd ZU dZdZded<   y)r%   aL  An ABC that details the common operations on a Discord model.

    Almost all :ref:`Discord models <discord_api_models>` meet this
    abstract base class.

    If you want to create a snowflake on your own, consider using
    :class:`.Object`.

    Attributes
    ----------
    id: :class:`int`
        The model's unique ID.
    rZ   rc   rh   N__name__
__module____qualname____doc__	__slots____annotations__rZ   r]   rM   r%   r%      s     IGr]   c                  l    e Zd ZU dZdZded<   ded<   ded<   ded	<   d
ed<   edd       Zedd       Zy)r&   a  An ABC that details the common operations on a Discord user.

    The following implement this ABC:

    - :class:`~discord.User`
    - :class:`~discord.ClientUser`
    - :class:`~discord.Member`

    This ABC must also implement :class:`~discord.abc.Snowflake`.

    Attributes
    ----------
    name: :class:`str`
        The user's username.
    discriminator: :class:`str`
        The user's discriminator.

        .. note::

            If the user has migrated to the new username system, this will always be "0".
    global_name: :class:`str`
        The user's global name.

        .. versionadded:: 2.5
    avatar: :class:`~discord.Asset`
        The avatar asset the user has.
    bot: :class:`bool`
        If the user is a bot account.
    rZ   strnamediscriminator
str | Noneglobal_namer/   avatarboolbotc                    t         )z Returns the user's display name.NotImplementedErrorselfs    rM   display_namezUser.display_name   
     "!r]   c                    t         )z;Returns a string that allows you to mention the given user.r   r   s    rM   mentionzUser.mention   r   r]   Nreturnr|   )	ru   rv   rw   rx   ry   rz   propertyr   r   rZ   r]   rM   r&   r&      sO    < I
IM	I" " " "r]   r&   c                       e Zd ZU dZdZded<   y)r'   ah  An ABC that details the common operations on a private Discord channel.

    The following implement this ABC:

    - :class:`~discord.DMChannel`
    - :class:`~discord.GroupChannel`

    This ABC must also implement :class:`~discord.abc.Snowflake`.

    Attributes
    ----------
    me: :class:`~discord.ClientUser`
        The user presenting yourself.
    rZ   rF   meNrt   rZ   r]   rM   r'   r'      s     INr]   r'   c                  8    e Zd ZdZdZdZd	dZd
dZddZddZ	y)_Overwritesrh   allowdenytyper   r   c                    t        |d         | _        t        |j                  dd            | _        t        |j                  dd            | _        |d   | _        y )Nrh   r   r   r   r   )rc   rh   getr   r   r   )r   datas     rM   __init__z_Overwrites.__init__  sJ    4:dhhw23
TXXfa01	#'<	r]   c                    | j                   t        | j                        t        | j                        | j                  dS )Nr   )rh   r|   r   r   r   r   s    rM   _asdictz_Overwrites._asdict  s0    ''_		NII	
 	
r]   c                4    | j                   | j                  k(  S N)r   ROLEr   s    rM   is_rolez_Overwrites.is_role'  s    yyDII%%r]   c                4    | j                   | j                  k(  S r   )r   MEMBERr   s    rM   	is_memberz_Overwrites.is_member*  s    yyDKK''r]   N)r   PermissionOverwritePayload)r   r   r   r   )
ru   rv   rw   ry   r   r   r   r   r   r   rZ   r]   rM   r   r     s%    /IDF0
&(r]   r   GCHr(   c            
      B   e Zd ZU dZdZ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<   er
	 	 	 	 	 	 d;dZd<dZe	d=d       Z
d>dZ	 	 d?	 	 	 	 	 	 	 	 	 d@dZ	 	 	 	 	 	 dAdZdBdZe	dCd       Ze	d<d       Ze	d<d       Ze	dDd        ZdEd!Ze	dFd"       Ze	dGd#       Ze	dHd$       ZdId%Zdd&dJd'Zed(d(d)	 	 	 	 	 	 	 dKd*       Zed(d&	 	 	 	 	 	 	 dLd+       Zedd)d,Zddd-	 	 	 	 	 	 	 	 	 dMd.Zddd-	 	 	 	 	 	 	 dNd/Zeeeeed0	 	 	 	 	 	 	 	 	 	 	 dOd1       Zeeeeed0	 	 	 	 	 	 	 	 	 	 	 dPd2       Zeeeeed0	 	 	 	 	 	 	 	 	 	 	 dQd3       Zeeeeed0	 	 	 	 	 	 	 	 	 	 	 dRd4       ZdSd5Zdd6d6dd7ddddd8		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dTd9ZdUd:Z y)Vr(   a  An ABC that details the common operations on a Discord guild channel.

    The following implement this ABC:

    - :class:`~discord.TextChannel`
    - :class:`~discord.VoiceChannel`
    - :class:`~discord.CategoryChannel`
    - :class:`~discord.StageChannel`
    - :class:`~discord.ForumChannel`

    This ABC must also implement :class:`~discord.abc.Snowflake`.

    Attributes
    ----------
    name: :class:`str`
        The channel name.
    guild: :class:`~discord.Guild`
        The guild the channel belongs to.
    position: :class:`int`
        The position in the channel list. This is a number that starts at 0.
        e.g. the top channel is position 0.
    rZ   rc   rh   r|   r}   r;   guildr   r   position
int | Nonecategory_idr:   flagsrA   _statezlist[_Overwrites]_overwritesc                    y r   rZ   )r   stater   r   s       rM   r   zGuildChannel.__init__W  s    r]   c                    | j                   S r   )r}   r   s    rM   __str__zGuildChannel.__str__[  s    yyr]   c                    t         r   r   r   s    rM   _sorting_bucketzGuildChannel._sorting_bucket^  s    !!r]   c                    t         r   r   )r   r   r   s      rM   _updatezGuildChannel._updateb      !!r]   NFc                 K   dk  rt        d      | j                  j                  }| j                  }| j                  j
                  D cg c]  }|j                  |k(  s| }}|j                  d        	 |j                  |        t        fdt        |      D        t        |            }	|j                  |	|        g }
t        |      D ]Y  \  }	}|j                  |	d}|t        ur,|j                  | j                  k(  r|j                  ||       |
j!                  |       [ |j#                  | j                  j                  |
|       d {    y c c}w # t        $ r Y y w xY w7 w)	Nr   z'Channel position cannot be less than 0.c                    | j                   S r   r   cs    rM   r[   z$GuildChannel._move.<locals>.<lambda>v  s
    AJJ r]   keyc              3  H   K   | ]  \  }}|j                   k\  s|  y wr   r   ).0ir   r   s      rM   	<genexpr>z%GuildChannel._move.<locals>.<genexpr>  s      Mtq!ajjH6LMs   ""rh   r   	parent_idlock_permissionsrG   )r   r   httpr   r   channelssortremovenext	enumerateleninsert
ValueErrorrh   ra   updateri   bulk_channel_update)r   r   r   r   rH   r   bucketr   r   indexpayloadds    `          rM   _movezGuildChannel._movee  s[     a<!"KLL{{%%zz**(
a.?.?6.IA(
 (
 	./	)OOD!
 My2MHE
 OOE4(!(+ 	HE1'(tt ?A'ADDDGGO9?OPNN1		 &&tzz}}gf&MMM7(
  		$ 	NsI   AE7E!#E!'E7=E& CE7E5
E7&	E2/E71E22E7c                  K   	 |j                  d      }|xr |j                  }	 |j                  d      |d<   	 |j                  d      |d<   	 |j                  d      rt        j
                  j                  |d<   	 |j                  d      D cg c]  }|j                          c}|d<   	 |j                  d	      }|d n
t        |      |d	<   	 |j                  d
      }t        |      |d
<   |j                  dd      }	 |j                  d      }	| j                  |	|||       d {    |j!                  d      }|g }|j#                         D ]  \  }}t%        |t&              s"t)        d|j*                  j,                         |j/                         \  }}|j0                  |j0                  |j                  t%        |t2              rt4        j6                  nt4        j8                  d}|j;                  |        ||d<   	 |d   }t%        |t<              st)        d      |j0                  |d<   	 |d   }t%        |t>              r|jA                         }nOt%        |t              rtC        d |      }n1t%        |t              rtC        jD                  |      }nt)        d      |jG                         |d<   |r; | jH                  jJ                  jL                  | j                  fd|i| d {   S y # t        $ r
 t        }Y w xY w# t        $ r Y w xY w# t        $ r Y w xY w# t        $ r Y w xY wc c}w # t        $ r Y w xY w# t        $ r Y w xY w# t        $ r Y w xY w7 R# t        $ r |t        urV|rN| j                  j                  |      }
|
r1|
j                  D cg c]  }|j                          nc c}w c}|d<   ||d<   nf|rd| j                  X| j                  j                  | j                        }
|
r1|
j                  D cg c]  }|j                          nc c}w c}|d<   Y  w xY w# t        $ r Y %w xY w# t        $ r Y w xY w7 xw)Ncategoryslowmode_delayrate_limit_per_userdefault_thread_slowmode_delay"default_thread_rate_limit_per_userrequire_tagr   available_tags
rtc_regionvideo_quality_modesync_permissionsFr   )r   r   rH   permission_overwritesr   
overwritesz&Expected PermissionOverwrite received )r   r   rh   r   r   z&type field must be of type ChannelTypedefault_reaction_emoji)r}   rh   z9default_reaction_emoji must be of type: Emoji | int | strrH   )'poprh   KeyErrorra   r:   r   flagto_dictr|   rc   r   r   get_channelr   r   r   r   items
isinstancer   r   	__class__ru   pairvaluer   r   r   r   ri   r   r   _to_partialr   from_str_to_forum_reaction_payloadr   r   edit_channel)r   optionsrH   parentr   tagr   r   r   r   r   r   r   permstargetpermr   r   r   ch_typer   s                        rM   _editzGuildChannel._edit  s    	-[[,F ,699I	-4[[9I-JG)*	<CKK/=G89	{{=)#/#;#;#@#@ 	)05E)F)"%)G$%	T \2J -7,>DC
OGL!	D!(-A!B -00B,CG()";;'95A	{{:.H& **#!1	     [[.
!E * 0 0 2 &!$(;<) NN3346 
 #iikt"[[ JJ )) &fd3 $(((//	 W%'&( 05G+,	,foG g{3%&NOO%mmGFO	%,-E%F" 0)<)?)K)K)M&2C8)5"8*& 2C8)5)>)>?U)V&%O 
 'AAC ,- 6))66 &*1   C  	 I	   		  		  		)  		
  		  		6%  	'##zz55i@H191E1E<,-AIIK< < 78 (1$!d&6&6&B  ::11$2B2BC-5-A-A8()		8 8G34	h  		  		*s  Q;L Q;L L, .L< ?M M)M 0M! Q;M1 % Q;N Q;/N0CQ;Q *Q; Q( B;Q; Q8Q;LQ;LQ;	L)%Q;(L))Q;,	L95Q;8L99Q;<	M	Q;M		Q;M 	MQ;MQ;!	M.*Q;-M..Q;1	M>:Q;=M>>Q;>QOAQ.QQQ;QQ;	Q%!Q;$Q%%Q;(	Q51Q;4Q55Q;c                t   g | _         d}| j                  j                  }t        |j	                  dg             D ][  \  }}t        |      }| j                   j                  |       |j                  t
        j                  k(  rJ|j                  |k(  sZ|}] | j                   }|r|d   ||   c||<   |d<   y y )Nr   r   )	r   r   rh   r   r   r   ri   r   r   )r   r   everyone_indexeveryone_idr   
overridden	overwritetmps           rM   _fill_overwriteszGuildChannel._fill_overwrites  s    jjmm!*4884KR+P!Q 	'E:#J/I##I.~~!3!33||{* "'	'  *-a&#n2E'CQ r]   c                B   g }| j                   }t        d | j                        D ]v  }|j                  |j                        }|!t        j
                  |      }|j                  j                  |j                  |j                         |j                  |       x |S )zReturns a list of roles that have been overridden from
        their default values in the :attr:`~discord.Guild.roles` attribute.
        c                "    | j                         S r   r   )os    rM   r[   z,GuildChannel.changed_roles.<locals>.<lambda>:  s    !))+ r]   )r   filterr   get_rolerh   copypermissionshandle_overwriter   r   ri   )r   rl   gr   roles        rM   changed_roleszGuildChannel.changed_roles3  s    
 JJ 5t7G7GH 	I::ill+D|99T?D--iooy~~NJJt	 
r]   c                "    d| j                    dS )z2The string that allows you to mention the channel.z<#>rh   r   s    rM   r   zGuildChannel.mentionD  s     DGG9Ar]   c                N    d| j                   j                   d| j                   S )zdReturns a URL that allows the client to jump to the channel.

        .. versionadded:: 2.0
        zhttps://discord.com/channels//)r   rh   r   s    rM   jump_urlzGuildChannel.jump_urlI  s#     /tzz}}oQtwwiHHr]   c                @    t        j                  | j                        S )z+Returns the channel's creation time in UTC.)r   snowflake_timerh   r   s    rM   
created_atzGuildChannel.created_atQ  s     ##DGG,,r]   c                X   t        |t              rd }nt        |t              rd }nd }t        || j                        D ]]  }|j
                  |j
                  k(  st        |j                        }t        |j                        }t        j                  ||      c S  t               S )a  Returns the channel-specific overwrites for a member or a role.

        Parameters
        ----------
        obj: Union[:class:`~discord.Role`, :class:`~discord.abc.User`]
            The role or user denoting
            whose overwrite to get.

        Returns
        -------
        :class:`~discord.PermissionOverwrite`
            The permission overwrites for this object.
        c                "    | j                         S r   )r   ps    rM   r[   z-GuildChannel.overwrites_for.<locals>.<lambda>f  s    !++- r]   c                "    | j                         S r   r  r  s    rM   r[   z-GuildChannel.overwrites_for.<locals>.<lambda>h  s    !))+ r]   c                     yrY   rZ   r  s    rM   r[   z-GuildChannel.overwrites_for.<locals>.<lambda>j  r\   r]   )r   r&   r   r  r   rh   r   r   r   r   	from_pair)r   obj	predicater   r   r   s         rM   overwrites_forzGuildChannel.overwrites_forV  s     c4 /IT"-I&I	4+;+;< 	BI||svv%#IOO4"9>>2*44UDAA		B #$$r]   c                   i }| j                   D ]  }t        |j                        }t        |j                        }t	        j
                  ||      }d}|j                         r&| j                  j                  |j                        }n5|j                         r%| j                  j                  |j                        }||||<    |S )a  Returns all of the channel's overwrites.

        This is returned as a dictionary where the key contains the target which
        can be either a :class:`~discord.Role` or a :class:`~discord.Member` and the value is the
        overwrite as a :class:`~discord.PermissionOverwrite`.

        Returns
        -------
        Dict[Union[:class:`~discord.Role`, :class:`~discord.Member`], :class:`~discord.PermissionOverwrite`]
            The channel's permission overwrites.
        N)r   r   r   r   r   r  r   r   r  rh   r   
get_member)r   rl   owr   r   r   r   s          rM   r   zGuildChannel.overwritest  s     "" 	(B)Erww'D+55eTBIFzz|,,RUU3..ruu5 !'F#	($ 
r]   c                L    | j                   j                  | j                        S )zfThe category this channel belongs to.

        If there is no category then this is ``None``.
        )r   r   r   r   s    rM   r   zGuildChannel.category  s     zz%%d&6&677r]   c                    | j                   y| j                  j                  | j                         }t        |xr |j                  | j                  k(        S )zWhether the permissions for this channel are synced with the
        category it belongs to.

        If there is no category then this is ``False``.

        .. versionadded:: 1.3
        F)r   r   r   r   r   )r   r   s     rM   permissions_syncedzGuildChannel.permissions_synced  sL     #::))$*:*:;HG!4!4!GHHr]   c                  | j                   j                  |j                  k(  rt        j                         S | j                   j
                  }t        |r|j                  j                  nd      }t        |t              r|xj                  |j                  z  c_        |j                  rt        j                         S 	 | j                  d   }|j                  | j                   j                  k(  r'|j                  |j                  |j                         |j#                         r|S t%        j&                  | j                  t(        j*                  |j                        }|&|j                  |j                  |j                         |S |j,                  }| j                   j.                  }|D ],  } ||      }	|	|xj                  |	j                  z  c_        . |j                  rt        j                         S 	 | j                  d   }|j                  | j                   j                  k(  r7|j                  |j                  |j                         | j                  dd }
n| j                  }
d}d}|
D ]M  }|j1                         s|j3                  |j                        s0||j                  z  }||j                  z  }O |j                  ||       |
D ]U  }|j5                         s|j                  |j                  k(  s.|j                  |j                  |j                          n |j6                  sd|_        d|_        d|_        d|_        |j@                  s4t        jB                         }|xj                  |j                   z  c_        |S # t         $ r Y w xY w# t         $ r | j                  }
Y Uw xY w)ar  Handles permission resolution for the :class:`~discord.Member`
        or :class:`~discord.Role`.

        This function takes into consideration the following cases:

        - Guild owner
        - Guild roles
        - Channel overrides
        - Member overrides

        If a :class:`~discord.Role` is passed, then it checks the permissions
        someone with that role would have, which is essentially:

        - The default role permissions
        - The permissions of the role used as a parameter
        - The default role permission overwrites
        - The permission overwrites of the role used as a parameter

        .. versionchanged:: 2.0
            The object passed in can now be a role object.

        Parameters
        ----------
        obj: Union[:class:`~discord.Member`, :class:`~discord.Role`]
            The object to resolve permissions for. This could be either
            a member or a role. If it's a role then member overwrites
            are not computed.

        Returns
        -------
        :class:`~discord.Permissions`
            The resolved permissions for the member or role.
        r   )r   r   )r   rh   Nr   F)"r   owner_idrh   r   alldefault_roler
  r   r   r   _permissionsadministratorr   r  r   r   
IndexError
is_defaultr   r   r   r   _rolesr  r   hasr   send_messagessend_tts_messagesmention_everyoneembed_linksattach_filesread_messagesall_channel)r   r  defaultbasemaybe_everyoner   rolesr  role_idr  remaining_overwritesdeniesallowsdenieds                 rM   permissions_forzGuildChannel.permissions_for  sC   b ::#&&(??$$**))7..44QG c4 JJ#***J!!"((!%!1!1!!4!$$

5)),229L9L *  ~~		$"2"29I9IcffUI$%%iooy~~FK

::&&  	0GG$D

d///
	0 ??$$
	4!--a0N  DJJMM1%%(..^5H5H &  (,'7'7';$'+'7'7$  . 	*I  "uyy'>)..()//)	*
 	F8 . 	I""$)?%%IOO)..%Q	 !!%*D"$)D!$D %D !! ,,.FJJ6<<-'JK  H  	4#'#3#3 	4s&   AN' A5N7 '	N43N47OOrG   c                  K   | j                   j                  j                  | j                  |       d{    y7 w)aP  |coro|

        Deletes the channel.

        You must have :attr:`~discord.Permissions.manage_channels` permission to use this.

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

        Raises
        ------
        ~discord.Forbidden
            You do not have proper permissions to delete the channel.
        ~discord.NotFound
            The channel was not found or was already deleted.
        ~discord.HTTPException
            Deleting the channel failed.
        rG   N)r   r   delete_channelrh   )r   rH   s     rM   rJ   zGuildChannel.delete9  s/     , kk--dggf-EEEs   5?=?.)r   rH   c                  K   y wr   rZ   )r   r   r   rH   s       rM   set_permissionszGuildChannel.set_permissionsQ           c                  K   y wr   rZ   )r   r   rH   r
  s       rM   rF  zGuildChannel.set_permissionsZ  rG  rH  c                 K   | j                   j                  }t        |t              rt        j
                  }n,t        |t              rt        j                  }nt        d      |t        u r&t        |      dk(  rt        d      	 t        d	i |}nt        |      dkD  rt        d      |1|j                  | j                  |j                  |       d{    yt        |t              r[|j!                         \  }}|j#                  | j                  |j                  |j$                  |j$                  ||       d{    yt        d      # t        t        f$ r t        d      w xY w7 7 0w)
a!
  |coro|

        Sets the channel specific permission overwrites for a target in the
        channel.

        The ``target`` parameter should either be a :class:`~discord.Member` or a
        :class:`~discord.Role` that belongs to guild.

        The ``overwrite`` parameter, if given, must either be ``None`` or
        :class:`~discord.PermissionOverwrite`. For convenience, you can pass in
        keyword arguments denoting :class:`~discord.Permissions` attributes. If this is
        done, then you cannot mix the keyword arguments with the ``overwrite``
        parameter.

        If the ``overwrite`` parameter is ``None``, then the permission
        overwrites are deleted.

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

        .. note::

            This method *replaces* the old overwrites with the ones given.

        Examples
        ----------

        Setting allow and deny: ::

            await message.channel.set_permissions(message.author, read_messages=True,
                                                                  send_messages=False)

        Deleting overwrites ::

            await channel.set_permissions(member, overwrite=None)

        Using :class:`~discord.PermissionOverwrite` ::

            overwrite = discord.PermissionOverwrite()
            overwrite.send_messages = False
            overwrite.read_messages = True
            await channel.set_permissions(member, overwrite=overwrite)

        Parameters
        -----------
        target: Union[:class:`~discord.Member`, :class:`~discord.Role`]
            The member or role to overwrite permissions for.
        overwrite: Optional[:class:`~discord.PermissionOverwrite`]
            The permissions to allow and deny to the target, or ``None`` to
            delete the overwrite.
        \*\*permissions
            A keyword argument list of permissions to set for ease of use.
            Cannot be mixed with ``overwrite``.
        reason: Optional[:class:`str`]
            The reason for doing this action. Shows up on the audit log.

        Raises
        -------
        ~discord.Forbidden
            You do not have permissions to edit channel specific permissions.
        ~discord.HTTPException
            Editing channel specific permissions failed.
        ~discord.NotFound
            The role or member being edited is not part of the guild.
        ~discord.InvalidArgument
            The overwrite parameter invalid or the target type was not
            :class:`~discord.Role` or :class:`~discord.Member`.
        z.target parameter must be either Member or Roler   zNo overwrite provided.z/Invalid permissions given to keyword arguments.z+Cannot mix overwrite and keyword arguments.NrG   z Invalid overwrite type provided.rZ   )r   r   r   r&   r   r   r   r   r   ra   r   r   r   	TypeErrordelete_channel_permissionsrh   r   edit_channel_permissionsr   )	r   r   r   rH   r
  r   	perm_typer   r   s	            rM   rF  zGuildChannel.set_permissionsc  s[    N {{fd##**I%#((I!"RSS;1$%&>??Y/>+>	 !!"OPP 11$''699V1TTT	#67%NN,MUD//EKKYv 0    ""DEE 	* Y%&WXXY Us>   BE8E AE8E4A*E8E6E8E11E86E8)r}   rH   c               
  K   | j                   D cg c]  }|j                          c}|d<   | j                  |d<   |xs | j                  |d<   | j                  j
                  }| j                  } | j                  j                  j                  || j                  j                  fd|i| d {   } || j                  | j                  |      }|| j                  j                  |j
                  <   |S c c}w 7 Mw)Nr   r   r}   rH   )r   r   r   )r   r   r   r}   r   rh   r   r   r   create_channelr   r   	_channels)	r   
base_attrsr}   rH   xguild_idclsr   r  s	            rM   _clone_implzGuildChannel._clone_impl  s      EIDTDT.Uqqyy{.U
*+"&"2"2
;!.TYY
6::==nn4T[[%%44diioo
.4
8B
 
 4::DA (+

SVV$
 /V

s   DC<BD3D4ADc                  K   t         w)a[  |coro|

        Clones this channel. This creates a channel with the same properties
        as this channel.

        You must have the :attr:`~discord.Permissions.manage_channels` permission to
        do this.

        .. versionadded:: 1.1

        Parameters
        ----------
        name: Optional[:class:`str`]
            The name of the new channel. If not provided, defaults to this
            channel name.
        reason: Optional[:class:`str`]
            The reason for cloning this channel. Shows up on the audit log.

        Returns
        -------
        :class:`.abc.GuildChannel`
            The channel that was created.

        Raises
        ------
        ~discord.Forbidden
            You do not have the proper permissions to create this channel.
        ~discord.HTTPException
            Creating the channel failed.
        r   )r   r}   rH   s      rM   clonezGuildChannel.clone  s     B "!   	)offsetr   r   rH   c                  K   y wr   rZ   )r   	beginningrZ  r   r   rH   s         rM   movezGuildChannel.move        rH  c                  K   y wr   rZ   )r   endrZ  r   r   rH   s         rM   r]  zGuildChannel.move  r^  rH  c                  K   y wr   rZ   )r   rR   rZ  r   r   rH   s         rM   r]  zGuildChannel.move  r^  rH  c                  K   y wr   rZ   )r   rS   rZ  r   r   rH   s         rM   r]  zGuildChannel.move"  r^  rH  c                  K   |sy|j                  d      |j                  d      }}|j                  d      |j                  d      c|j                  dd      }t        d ||fD              d	kD  rt        d
      | j                  }|j                  dt              }|t        dfvrN|j
                  }| j                  j                  D cg c]"  }|j                  |k(  r|j                  |k(  r|$ }}nK| j                  j                  D cg c],  }|j                  |k(  r|j                  | j                  k(  r|. }}|j                  d        	 |j                  |        d}	|rd}	nO|rt        |      }	nArt        fdt        |      D        d      }	n rt        fdt        |      D        d      }	|	t        d      |j                  t!        |	|z   d      |        g }
|j                  dd      }|j                  d      }t        |      D ]Y  \  }	}|j
                  |	d}|t        ur,|j
                  | j
                  k(  r|j#                  ||       |
j%                  |       [ | j&                  j(                  j+                  | j                  j
                  |
|       d{    yc c}w c c}w # t        $ r Y iw xY w7 w)a	  |coro|

        A rich interface to help move a channel relative to other channels.

        If exact position movement is required, ``edit`` should be used instead.

        You must have the :attr:`~discord.Permissions.manage_channels` permission to
        do this.

        .. note::

            Voice channels will always be sorted below text channels.
            This is a Discord limitation.

        .. versionadded:: 1.7

        Parameters
        ----------
        beginning: :class:`bool`
            Whether to move the channel to the beginning of the
            channel list (or category if given).
            This is mutually exclusive with ``end``, ``before``, and ``after``.
        end: :class:`bool`
            Whether to move the channel to the end of the
            channel list (or category if given).
            This is mutually exclusive with ``beginning``, ``before``, and ``after``.
        before: :class:`~discord.abc.Snowflake`
            The channel that should be before our current channel.
            This is mutually exclusive with ``beginning``, ``end``, and ``after``.
        after: :class:`~discord.abc.Snowflake`
            The channel that should be after our current channel.
            This is mutually exclusive with ``beginning``, ``end``, and ``before``.
        offset: :class:`int`
            The number of channels to offset the move by. For example,
            an offset of ``2`` with ``beginning=True`` would move
            it 2 after the beginning. A positive number moves it below
            while a negative number moves it above. Note that this
            number is relative and computed after the ``beginning``,
            ``end``, ``before``, and ``after`` parameters.
        category: Optional[:class:`~discord.abc.Snowflake`]
            The category to move this channel under.
            If ``None`` is given then it moves it out of the category.
            This parameter is ignored if moving a category channel.
        sync_permissions: :class:`bool`
            Whether to sync the permissions with the category (if given).
        reason: :class:`str`
            The reason for the move.

        Raises
        ------
        InvalidArgument
            An invalid position was given or a bad mix of arguments was passed.
        Forbidden
            You do not have permissions to move the channel.
        HTTPException
            Moving the channel failed.
        Nr\  r`  rR   rS   rZ  r   c              3  2   K   | ]  }t        |        y wr   )r   )r   as     rM   r   z$GuildChannel.move.<locals>.<genexpr>n  s     @1tAw@s   r   z8Only one of [before, after, end, beginning] can be used.r   c                2    | j                   | j                  fS r   )r   rh   r   s    rM   r[   z#GuildChannel.move.<locals>.<lambda>  s    QZZ$6 r]   r   c              3  \   K   | ]#  \  }}|j                   j                   k(  s | % y wr   r  )r   r   r   rR   s      rM   r   z$GuildChannel.move.<locals>.<genexpr>  s$     Q1qttvyy?P!Qs   !,,c              3  b   K   | ]&  \  }}|j                   j                   k(  s |d z    ( yw)r   Nr  )r   r   r   rS   s      rM   r   z$GuildChannel.move.<locals>.<genexpr>  s(     K41a!$$%((:JQKs   !/
/z+Could not resolve appropriate move positionr   FrH   r   r   rG   )r   sumr   r   ra   rh   r   r   r   r   r   r   r   r   r   r   maxr   ri   r   r   r   )r   kwargsr\  r`  rZ  r   r   chr   r   r   r   rH   rj   r   rS   rR   s                  @@rM   r]  zGuildChannel.move-  s    v K0&**U2C3	

8,fjj.AHa(@C ?@@1D!J  %%JJz73	WdO+!I **--%%/BNNi4O H  **--%%/BNNdFVFV4V H  	67	OOD!
 EMEQ	((;QSWXEK9X#6KTE =!"OPPUV^a0$7!::&8%@H%'1 	NE7zzu5A'GJJ$'',A9?OPNN1		 kk22JJMM76 3 
 	
 	
]  		:	
sO   CK'K :K1KKK
 -EK:K;K
	KKKKr   T)	rH   max_agemax_uses	temporaryuniquetarget_eventtarget_typetarget_usertarget_application_idc       	        2  K   | j                   j                  j                  | j                  ||||||r|j                  nd|r|j                  nd|		       d{   }
t        j                  |
| j                         }|r|j                  |       |S 7 :w)a
	  |coro|

        Creates an instant invite from a text or voice channel.

        You must have the :attr:`~discord.Permissions.create_instant_invite` permission to
        do this.

        Parameters
        ----------
        max_age: :class:`int`
            How long the invite should last in seconds. If it's 0 then the invite
            doesn't expire. Defaults to ``0``.
        max_uses: :class:`int`
            How many uses the invite could be used for. If it's 0 then there
            are unlimited uses. Defaults to ``0``.
        temporary: :class:`bool`
            Denotes that the invite grants temporary membership
            (i.e. they get kicked after they disconnect). Defaults to ``False``.
        unique: :class:`bool`
            Indicates if a unique invite URL should be created. Defaults to True.
            If this is set to ``False`` then it will return a previously created
            invite.
        reason: Optional[:class:`str`]
            The reason for creating this invite. Shows up on the audit log.
        target_type: Optional[:class:`.InviteTarget`]
            The type of target for the voice channel invite, if any.

            .. versionadded:: 2.0

        target_user: Optional[:class:`User`]
            The user whose stream to display for this invite, required if `target_type` is `TargetType.stream`.
            The user must be streaming in the channel.

            .. versionadded:: 2.0

        target_application_id: Optional[:class:`int`]
            The id of the embedded application for the invite, required if `target_type` is
            `TargetType.embedded_application`.

            .. versionadded:: 2.0

        target_event: Optional[:class:`.ScheduledEvent`]
            The scheduled event object to link to the event.
            Shortcut to :meth:`.Invite.set_scheduled_event`

            See :meth:`.Invite.set_scheduled_event` for more
            info on event invite linking.

            .. versionadded:: 2.0

        Returns
        -------
        :class:`~discord.Invite`
            The invite that was created.

        Raises
        ------
        ~discord.HTTPException
            Invite creation failed.

        ~discord.NotFound
            The channel that was passed is a category or an invalid channel.
        N)rH   rm  rn  ro  rp  rr  target_user_idrt  )r   r   )r   r   create_inviterh   r   r   from_incompleteset_scheduled_event)r   rH   rm  rn  ro  rp  rq  rr  rs  rt  r   invites               rM   rw  zGuildChannel.create_invite  s     Z [[%%33GG-8))d-8;>>d"7 4 

 

 ''TE&&|4

s   ABB;Bc           	        K   | j                   }|j                  j                  | j                         d{   }| j                  }|D cg c]  }t        ||| |       c}S 7 -c c}w w)a  |coro|

        Returns a list of all active instant invites from this channel.

        You must have :attr:`~discord.Permissions.manage_channels` to get this information.

        Returns
        -------
        List[:class:`~discord.Invite`]
            The list of invites that are currently active.

        Raises
        ------
        ~discord.Forbidden
            You do not have proper permissions to get the information.
        ~discord.HTTPException
            An error occurred while fetching the information.
        N)r   r   rj   r   )r   r   invites_from_channelrh   r   r   )r   r   r   r   rz  s        rM   inviteszGuildChannel.invites  sg     ( ZZ44TWW==

 
 VTG
 	
 >
s!   5A,A%A,A'"A,'A,)r   rA   r   r;   r   dict[str, Any]r   )r   rc   )r   r;   r   r~  r   None)NF)
r   rc   r   z
Any | Noner   r   rH   r   r   r  )r   r~  rH   r   r   zChannelPayload | None)r   GuildChannelPayloadr   r  )r   z
list[Role])r   r.   )r  zRole | Userr   r   )r   z(dict[Role | Member, PermissionOverwrite])r   zCategoryChannel | Noner   )r  Member | Roler   r   )rH   r   r   r  )r   r  r   zPermissionOverwrite | NonerH   r   r   r  )r   r  rH   r   r
  r   r   r  )
r   r   rR  r~  r}   r   rH   r   r   r   )r   r   r}   r   rH   r   r   r   )r\  r   rZ  rc   r   Snowflake | Noner   r   rH   r   r   r  )r`  r   rZ  rc   r   r  r   r   rH   r|   r   r  )rR   r%   rZ  rc   r   r  r   r   rH   r|   r   r  )rS   r%   rZ  rc   r   r  r   r   rH   r|   r   r  r   r  )rH   r   rm  rc   rn  rc   ro  r   rp  r   rq  zScheduledEvent | Nonerr  zInviteTarget | Noners  zUser | Nonert  r   r   r   )r   zlist[Invite])!ru   rv   rw   rx   ry   rz   r   r   r   r   r   r   r   r   r  r  r   r  r  r!  r   r   r'  rB  rJ   r   rF  ra   rV  rX  r]  rw  r}  rZ   r]   rM   r(   r(   1  s   . IG
IL
M""	+	49	AO	 " "" !%!&	(N(N (N 	(N (N 
(NTI%I/9I	IVF2      I I - -%<  B 8 8 I IJX 48 F0 
 14  .	
  
  
 !	 	
  
  $+4dFT  !" 	
  
, *.D!"!"&!"7A!"	!"F 
 %,!($  	
 #   
  
 %,!(  	
 #   
  
 %,!(  	
 #   
  
 %,!(  	
 #   
 {
@ ".2+/#',0[ [ 	[
 [ [ [ ,[ )[ ![  *[ 
[z
r]   c                  z   e Zd ZU dZdZded<   ddZe	 dddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 dddddddddddddddd		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
       Ze	 dddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 dddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z	 d ddddddddddddddddddZd!dZ	d"dZ
d#dZd$dZd%dZdddddd	 	 	 	 	 	 	 	 	 	 	 d&dZy)'r)   a  An ABC that details the common operations on a model that can send messages.

    The following implement this ABC:

    - :class:`~discord.TextChannel`
    - :class:`~discord.VoiceChannel`
    - :class:`~discord.StageChannel`
    - :class:`~discord.DMChannel`
    - :class:`~discord.GroupChannel`
    - :class:`~discord.User`
    - :class:`~discord.Member`
    - :class:`~discord.ext.commands.Context`
    - :class:`~discord.Thread`
    - :class:`~discord.ApplicationContext`
    rZ   rA   r   c                   K   t         wr   r   r   s    rM   _get_channelzMessageable._get_channel8  s     !!rY  .)ttsembedfilestickersdelete_afternonceenforce_nonceallowed_mentions	referencemention_authorviewpollsuppresssilentc                  K   y wr   rZ   )r   contentr  r  r  r  r  r  r  r  r  r  r  r  r  r  s                   rM   sendzMessageable.send;       & rH  )r  r  filesr  r  r  r  r  r  r  r  r  r  r  c                  K   y wr   rZ   )r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                   rM   r  zMessageable.sendP  r  rH  )r  embedsr  r  r  r  r  r  r  r  r  r  r  r  c                  K   y wr   rZ   )r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                   rM   r  zMessageable.sende  r  rH  )r  r  r  r  r  r  r  r  r  r  r  r  r  r  c                  K   y wr   rZ   )r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                   rM   r  zMessageable.sendz  r  rH  N)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  c                 K   | j                          d{   }| j                  }|t        |      nd}||t        d      ||j	                         }n8|6t        |      dkD  rt        d      |D cg c]  }|j	                          }}t        t        |      t        |            j                  }||D cg c]  }|j                   }}|)|j                  xr |j                  j	                         }nF|j                  *|j                  j                  |      j	                         }n|j	                         }|*|xs t               j	                         }t        |      |d<   |	 |j                         }|r5t        |d      st        d	|j                         |j#                         }nd}|r|j	                         }||t        d
      |it%        |t&              st        d      	 |j(                  j+                  |j                  |g|||||	|
|||||       d{   }|j-                          n|t        |      dkD  rt        d      t/        d |D              st        d      	 |j(                  j+                  |j                  |||||	|
||||||       d{   }|D ]  }|j-                           n:|j(                  j1                  |j                  ||||	|
||||||       d{   }|j3                  ||      }|r#|j5                  ||j                         ||_        ||j9                  |       d{    |S 7 Oc c}w c c}w # t        $ r t        d      dw xY w7 X# |j-                          w xY w7 # |D ]  }|j-                           w xY w7 7 dw)a  |coro|

        Sends a message to the destination with the content given.

        The content must be a type that can convert to a string through ``str(content)``.
        If the content is set to ``None`` (the default), then the ``embed`` parameter must
        be provided.

        To upload a single file, the ``file`` parameter should be used with a
        single :class:`~discord.File` object. To upload multiple files, the ``files``
        parameter should be used with a :class:`list` of :class:`~discord.File` objects.
        **Specifying both parameters will lead to an exception**.

        To upload a single embed, the ``embed`` parameter should be used with a
        single :class:`~discord.Embed` object. To upload multiple embeds, the ``embeds``
        parameter should be used with a :class:`list` of :class:`~discord.Embed` objects.
        **Specifying both parameters will lead to an exception**.

        Parameters
        ----------
        content: Optional[:class:`str`]
            The content of the message to send.
        tts: :class:`bool`
            Indicates if the message should be sent using text-to-speech.
        embed: :class:`~discord.Embed`
            The rich embed for the content.
        file: :class:`~discord.File`
            The file to upload.
        files: List[:class:`~discord.File`]
            A list of files to upload. Must be a maximum of 10.
        nonce: Union[:class:`str`, :class:`int`]
            The nonce to use for sending this message. If the message was successfully sent,
            then the message will have a nonce with this value.
        enforce_nonce: Optional[:class:`bool`]
            Whether :attr:`nonce` is enforced to be validated.

            .. versionadded:: 2.5
        delete_after: :class:`float`
            If provided, the number of seconds to wait in the background
            before deleting the message we just sent. If the deletion fails,
            then it is silently ignored.
        allowed_mentions: :class:`~discord.AllowedMentions`
            Controls the mentions being processed in this message. If this is
            passed, then the object is merged with :attr:`~discord.Client.allowed_mentions`.
            The merging behaviour only overrides attributes that have been explicitly passed
            to the object, otherwise it uses the attributes set in :attr:`~discord.Client.allowed_mentions`.
            If no object is passed at all then the defaults given by :attr:`~discord.Client.allowed_mentions`
            are used instead.

            .. versionadded:: 1.4

        reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
            A reference to the :class:`~discord.Message` to which you are replying, this can be created using
            :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
            whether this mentions the author of the referenced message using the
            :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
            setting ``mention_author``.

            .. versionadded:: 1.6

        mention_author: Optional[:class:`bool`]
            If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``.

            .. versionadded:: 1.6
        view: :class:`discord.ui.View`
            A Discord UI View to add to the message.
        embeds: List[:class:`~discord.Embed`]
            A list of embeds to upload. Must be a maximum of 10.

            .. versionadded:: 2.0
        stickers: Sequence[Union[:class:`~discord.GuildSticker`, :class:`~discord.StickerItem`]]
            A list of stickers to upload. Must be a maximum of 3.

            .. versionadded:: 2.0
        suppress: :class:`bool`
            Whether to suppress embeds for the message.
        silent: :class:`bool`
            Whether to suppress push and desktop notifications for the message.

            .. versionadded:: 2.4
        poll: :class:`Poll`
            The poll to send.

            .. versionadded:: 2.6

        Returns
        -------
        :class:`~discord.Message`
            The message that was sent.

        Raises
        ------
        ~discord.HTTPException
            Sending the message failed.
        ~discord.Forbidden
            You do not have the proper permissions to send the message.
        ~discord.InvalidArgument
            The ``files`` list is not of the appropriate size,
            you specified both ``file`` and ``files``,
            or you specified both ``embed`` and ``embeds``,
            or the ``reference`` object is not a :class:`~discord.Message`,
            :class:`~discord.MessageReference` or :class:`~discord.PartialMessage`.
        Nz5cannot pass both embed and embeds parameter to send()
   z4embeds parameter must be a list of up to 10 elements)suppress_embedssuppress_notificationsreplied_userzHreference parameter must be Message, MessageReference, or PartialMessage__discord_ui_view__z view parameter must be View not z3cannot pass both file and files parameter to send()zfile parameter must be File)r  r  r  r  r  r  r  r  message_referencer  
componentsr   r  z3files parameter must be a list of up to 10 elementsc              3  <   K   | ]  }t        |t                y wr   )r   r   )r   r  s     rM   r   z#Messageable.send.<locals>.<genexpr>j  s     BDD$/Bs   z&files parameter must be a list of File)r  r  r  r  r  r  r  r  r  r  r  r   r  )r  r  r  r  r  r  r  r  r  r   r  rj   r   )delay)r  r   r|   r   r   r   r   r   r   rh   r  merger   to_message_reference_dictAttributeErrorhasattrr   to_componentsr   r   r   
send_filescloser*  send_messagecreate_message
store_viewrp   rJ   )r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rj   r   r   stickerr  r   frl   s                             rM   r  zMessageable.send  s(    z ))++")"5#g,4!3!G  MMOE6{R%J  4::%emmo:F: N#'<
 % 	
 2:;w

;H;#&&K5+A+A+I+I+K  ##/$55;;<LMUUW/779%/N?3D3L3L3N/3N/C^, %??A	 4!67%6t~~6HI  ++-JJ<<>D 1!"WXXdD)%&CDD"ZZ22JJ&%5#!"/&/%) 3  " 

5zB%I  BEBB%&NOO"ZZ22JJ#!"/%5&/%) 3  "  AGGI 00

+!1"+!% 1  D  ""7">T366*DL#**<*000
[ ," ; <$ " %& 6" 

"  AGGI, 1s   OM%A O7M(1O?M-B!O4M2 A7O<7N 3N4N 8A	O6N% 8N#9N% =AO
OAOOO(
O2NON N  O#N% %N>>OOc                   K   | j                          d{   }| j                  j                  j                  |j                         d{    y7 <7 w)z|coro|

        Triggers a *typing* indicator to the destination.

        *Typing* indicator will go away after 10 seconds, or after a message is sent.
        N)r  r   r   send_typingrh   )r   rj   s     rM   trigger_typingzMessageable.trigger_typing  sD      ))++kk**7::666 ,6s!   AA6AAAAc                    t        |       S )a  Returns a context manager that allows you to type for an indefinite period of time.

        This is useful for denoting long computations in your bot.

        .. note::

            This is both a regular context manager and an async context manager.
            This means that both ``with`` and ``async with`` work with this.

        Example Usage: ::

            async with channel.typing():
                # simulate something heavy
                await asyncio.sleep(10)

            await channel.send('done!')
        r   r   s    rM   typingzMessageable.typing  s    $ d|r]   c                  K   | j                          d{   }| j                  j                  j                  |j                  |       d{   }| j                  j                  ||      S 7 Y7 #w)a?  |coro|

        Retrieves a single :class:`~discord.Message` from the destination.

        Parameters
        ----------
        id: :class:`int`
            The message ID to look for.

        Returns
        -------
        :class:`~discord.Message`
            The message asked for.

        Raises
        ------
        ~discord.NotFound
            The specified message was not found.
        ~discord.Forbidden
            You do not have the permissions required to get a message.
        ~discord.HTTPException
            Retrieving the message failed.
        Nr  )r  r   r   get_messagerh   r  )r   rh   rj   r   s       rM   fetch_messagezMessageable.fetch_message  s_     2 ))++[[%%11'**bAA{{))')EE ,As!   A4A07A4A2"A42A4c                   K   | j                          d{   }| j                  }|j                  j                  |j                         d{   }|D cg c]  }|j                  ||       c}S 7 ^7 'c c}w w)a  |coro|

        Retrieves all messages that are currently pinned in the channel.

        .. note::

            Due to a limitation with the Discord API, the :class:`.Message`
            objects returned by this method do not contain complete
            :attr:`.Message.reactions` data.

        Returns
        -------
        List[:class:`~discord.Message`]
            The messages that are currently pinned.

        Raises
        ------
        ~discord.HTTPException
            Retrieving the pinned messages failed.
        Nr  )r  r   r   	pins_fromrh   r  )r   rj   r   r   rL   s        rM   pinszMessageable.pins  sj     , ))++ZZ))'**55GKL!$$W1$=LL ,5Ls3   A>A58A>A7A>A92A>7A>9A>c                
   dddddd}t        | d      r| }n;t        | d      r.t        | j                        j                  d	vr| j                  }ny
d|z   }|D ]  }	 ||d   }n5|j	                  t        |      j                        xs ||j                     }t        |      j                  dk(  r>|j                         j                  s#|j                  |j                  j                  k(  r=t        |      j                  dk(  r$|j                  |j                  j                  k(  rt        |j                  |j                  j                        |      r y y
# t        t        f$ r t        d| d      w xY w)aF  Returns a :class:`bool` indicating whether you have the permissions to send the object(s).

        Returns
        -------
        :class:`bool`
            Indicates whether you have the permissions to send the object(s).

        Raises
        ------
        TypeError
            An invalid type has been passed.
        r2  r5  r6  use_external_emojisuse_external_stickers)r=   r8   r   Emojir!   rB  rj   )r1   r2   Tr   r=   r  r!   zThe object z is of an invalid type.F)r  r   rj   ru   r   r   is_unicode_emojirT  r   rh   r   r  rK  getattrrB  r   )r   objectsmappingrj   r  
permissions         rM   can_sendzMessageable.can_send  sw    '""*3
 4*+GT9%$t||*<*E*E N
 +
 llGG# 	CL;!(!3J  DI$6$67P73<<;P  9%%0)::<<7==+;+;; #Y''>9||w}}'7'77 
 7227==3C3CDjQ/	2  n- L+cU2I JKKLs   BE#2;E##FrO   rP   rR   rS   rT   rU   c               $    t        | |||||      S )a	  Returns an :class:`~discord.AsyncIterator` that enables receiving the destination's message history.

        You must have :attr:`~discord.Permissions.read_message_history` permissions to use this.

        Parameters
        ----------
        limit: Optional[:class:`int`]
            The number of messages to retrieve.
            If ``None``, retrieves every message in the channel. Note, however,
            that this would make it a slow operation.
        before: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve messages before this date or message.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.
        after: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve messages after this date or message.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.
        around: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve messages around this date or message.
            If a datetime is provided, it is recommended to use a UTC aware datetime.
            If the datetime is naive, it is assumed to be local time.
            When using this argument, the maximum limit is 101. Note that if the limit is an
            even number, then this will return at most limit + 1 messages.
        oldest_first: Optional[:class:`bool`]
            If set to ``True``, return messages in oldest->newest order. Defaults to ``True`` if
            ``after`` is specified, otherwise ``False``.

        Yields
        ------
        :class:`~discord.Message`
            The message with the message data parsed.

        Raises
        ------
        ~discord.Forbidden
            You do not have permissions to get channel message history.
        ~discord.HTTPException
            The request to get message history failed.

        Examples
        --------

        Usage ::

            counter = 0
            async for message in channel.history(limit=200):
                if message.author == client.user:
                    counter += 1

        Flattening into a list: ::

            messages = await channel.history(limit=123).flatten()
            # messages is now a list of Message...

        All parameters are optional.
        r  r   )r   rP   rR   rS   rT   rU   s         rM   rb   zMessageable.history.  s$    D %
 	
r]   )r   MessageableChannel).) r  r   r  r   r  r8   r  r   r  $Sequence[GuildSticker | StickerItem]r  floatr  	int | strr  r   r  r   r  +Message | MessageReference | PartialMessager  r   r  rE   r  r@   r  r   r  r   r   r=   ) r  r   r  r   r  r8   r  
list[File]r  r  r  r  r  r  r  r   r  r   r  r  r  r   r  rE   r  r@   r  r   r  r   r   r=   ) r  r   r  r   r  list[Embed]r  r   r  r  r  r  r  r  r  r   r  r   r  r  r  r   r  rE   r  r@   r  r   r  r   r   r=   ) r  r   r  r   r  r  r  r  r  r  r  r  r  r  r  r   r  r   r  r  r  r   r  rE   r  r@   r  r   r  r   r   r=   r   r  )r   r   )rh   rc   r   r=   )r   list[Message]r   )rP   r   rR   SnowflakeTime | NonerS   r  rT   r  rU   bool | Noner   r   )ru   rv   rw   rx   ry   rz   r  r   r  r  r  r  r  r  rb   rZ   r]   rM   r)   r)   $  sr     I"  " 9<!!,/AD"# 	
   7    * ?     !" #$ 
% (  " 9<!!,/AD"# 	
   7    * ?     !" #$ 
% (  " !9<!!,/AD"# 	
   7    * ?     !" #$ 
% (  " !9<!!,/AD"# 	
   7    * ?     !" #$ 
% , J 'JX	7(F:M6:~  '+&*'+$(I
 I
 %	I

 $I
 %I
 "I
 
I
r]   r)   c                  P    e Zd ZU dZdZded<   ddZddZdded		 	 	 	 	 	 	 dd
Z	y)r*   al  An ABC that details the common operations on a channel that can
    connect to a voice server.

    The following implement this ABC:

    - :class:`~discord.VoiceChannel`
    - :class:`~discord.StageChannel`

    Note
    ----
    This ABC is not decorated with :func:`typing.runtime_checkable`, so will fail :func:`isinstance`/:func:`issubclass`
    checks.
    rZ   rA   r   c                    t         r   r   r   s    rM   _get_voice_client_keyz!Connectable._get_voice_client_key  r   r]   c                    t         r   r   r   s    rM   _get_voice_state_pairz!Connectable._get_voice_state_pair  r   r]   g      N@T)timeout	reconnectrU  c                 K   | j                         \  }}| j                  }|j                  |      rt        d      |j	                         } |||       }t        |t              st        d      |j                  ||       	 |j                  ||       d{    |S 7 # t        j                  $ r- 	 |j                  d       d{  7    # t        $ r Y  w xY ww xY ww)an  |coro|

        Connects to voice and creates a :class:`VoiceClient` to establish
        your connection to the voice server.

        This requires :attr:`Intents.voice_states`.

        Parameters
        ----------
        timeout: :class:`float`
            The timeout in seconds to wait for the voice endpoint.
        reconnect: :class:`bool`
            Whether the bot should automatically attempt
            a reconnect if a part of the handshake fails
            or the gateway goes down.
        cls: Type[:class:`VoiceProtocol`]
            A type that subclasses :class:`~discord.VoiceProtocol` to connect with.
            Defaults to :class:`~discord.VoiceClient`.

        Returns
        -------
        :class:`~discord.VoiceProtocol`
            A voice client that is fully connected to the voice server.

        Raises
        ------
        asyncio.TimeoutError
            Could not connect to the voice channel in time.
        ~discord.ClientException
            You are already connected to a voice channel.
        ~discord.opus.OpusNotLoaded
            The opus library has not been loaded.
        z%Already connected to a voice channel.z1Type must meet VoiceProtocol abstract base class.)r  r  NT)force)r  r   _get_voice_clientr   _get_clientr   r$   rK  _add_voice_clientconnectrf   TimeoutError
disconnect	Exception)	r   r  r  rU  key_id_r   clientvoices	            rM   r  zConnectable.connect  s     R ..0	""6*!"IJJ""$FD!%/OPP.	--9-EEE  F## 	&&T&222   	s`   BC'B$ B"B$  C'"B$ $C$8CCCC$	C C$C  C$$C'N)r   ztuple[int, str])r   ztuple[int, int])r  r  r  r   rU  z"Callable[[Client, Connectable], T]r   r,   )
ru   rv   rw   rx   ry   rz   r  r  r#   r  rZ   r]   rM   r*   r*   z  s[     I"" 2=A A 	A
 0A 
Ar]   r*   c                      e Zd Zy)r+   N)ru   rv   rw   rZ   r]   rM   r+   r+     s    r]   r+   )rK   zIterable[Message]rH   r   )rj   z2TextChannel | StageChannel | Thread | VoiceChannelrP   r   rQ   zCallable[[Message], bool]rR   r  rS   r  rT   r  rU   r  rV   r   rH   r   r   r  )nrx   
__future__r   rf   r	  rd   r  r   r   r   r   r   r	   r
   r   r   r    r   context_managersr   enumsr   errorsr   r   r  r   r   r   rz  r   	iteratorsr   mentionsr   partial_emojir   r   r
  r   r   r  r   scheduled_eventsr    r  r!   r"   voice_clientr#   r$   __all__r,   r.   assetr/   rj   r0   r1   r2   r3   r4   r5   r6   r  r7   r  r8   r9   r:   r   r;   memberr<   rp   r=   r>   r?   r  r@   r   rA   threadsrB   types.channelrC   ChannelPayloadr(   r  rD   r   ui.viewrE   userrF   PartialMessageableChannelr  SnowflakeTimera   rN   rr   r%   r&   r'   r   r   r)   r*   r+   rZ   r]   rM   <module>r     s<  2 #       $  4    & % 2 9  , . 4 C}%!   ##BB&8B,P  %\<DVV! 8,FG+x/0M
-- :>&&,6& '.#'"&#' %=?= = %	=
 !=  = != = = = =@   & /"9h /" /"d Y  *( (6 e>*p
 p
fS	
 S	
lY( Yx	 	r]   