
    i"             	      R   U 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mZmZmZ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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(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3m4Z4 ddl5m6Z6m7Z7 ddl8m9Z9 ddl:m;Z; ddl<Z<dZ= ede4          Z>erddl?m@Z@mAZA ddlBmCZC ddlDmEZE ddlFmGZG ddlHmIZI ddlJmKZK ddlLmMZM ddlNmOZO dd lPmQZQ dd!lRmSZSmTZTmUZU dd"lNmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\ dd#l]m^Z^ dd$l_m`Z` dd%lambZbmcZcmdZd dd&lem(ZfmgZhmiZjmkZk dd'llmmZm dd(lnmoZo dd)l'mpZp eeVe[e\e`eWeYf         ZqeeqeXf         Zred*ef         Zs G d+ d,eS          Zte9ju        Zu G d- d.          Zv ev            Zwd/exd0<    G d1 d2          Zydd3dZd8Zzd9euddddd:dd;d[dLZ{e G dM d*e                      Z|e G dN dOe|e                      Z} G dP dQ          Z~ G dR dS          Z G dT dU          Zi G dV dW          Z G dX dYe          ZdS )\a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

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

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotationsN)datetime)AnyAsyncIteratorCallableDict	GeneratorIterableListLiteralOptionalTYPE_CHECKINGProtocolSequenceTupleTypeVarUnionoverloadruntime_checkable   )OLDEST_OBJECTObjectTyping)ChannelTypeInviteTarget)ClientExceptionNotFound)AllowedMentions)PermissionOverwritePermissions)RoleInvite)File)handle_message_parameters)VoiceClientVoiceProtocol)GuildStickerStickerItem)utils)InviteFlags)	SnowflakeUserPrivateChannelGuildChannelMessageableConnectableT)bound)SelfUnpack)Client)
ClientUser)Asset)ConnectionState)Guild)Member)CategoryChannel)Embed)MessageMessageReferencePartialMessage)TextChannel	DMChannelGroupChannelPartialMessageableVocalGuildChannelVoiceChannelStageChannel)Poll)Thread)BaseViewView
LayoutView)r    Channelr0   OverwriteType)ChannelPositionUpdate)SnowflakeList)_PermissionOverwriteKwargsr-   c                  $    e Zd ZU ded<   ded<   dS )PinnedMessager   	pinned_atzLiteral[True]pinnedN)__name__
__module____qualname____annotations__     R/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/abc.pyrT   rT   y   s*         r\   rT   c                      e Zd ZddZdS )
_Undefinedreturnstrc                    dS )Nz	see-belowr[   selfs    r]   __repr__z_Undefined.__repr__   s    {r\   Nr`   ra   )rW   rX   rY   re   r[   r\   r]   r_   r_      s(             r\   r_   r   
_undefinedc                  &    e Zd Zd
dZddZddZd	S )_PinsIteratoriteratorAsyncIterator[PinnedMessage]r`   Nonec                    || _         d S N_PinsIterator__iterator)rd   rj   s     r]   __init__z_PinsIterator.__init__   s    8@r\   )Generator[Any, None, List[PinnedMessage]]c                     t          j        dt          d           d fd} |                                            S )Nz\`await <channel>.pins()` is deprecated; use `async for message in <channel>.pins()` instead.   )
stacklevelr`   List[PinnedMessage]c                 6   K   d  j         2              d {V S )Nc                "   K   g | 3 d {V }|
6 S rn   r[   ).0msgs     r]   
<listcomp>z;_PinsIterator.__await__.<locals>.gather.<locals>.<listcomp>   s.      99999999#C9999s   ro   rc   s   r]   gatherz'_PinsIterator.__await__.<locals>.gather   s/      999999999999r\   )r`   rv   )warningswarnDeprecationWarning	__await__)rd   r|   s   ` r]   r   z_PinsIterator.__await__   s]    j	
 	
 	
 	
	: 	: 	: 	: 	: 	: vxx!!###r\   c                    | j         S rn   ro   rc   s    r]   	__aiter__z_PinsIterator.__aiter__   s
    r\   N)rj   rk   r`   rl   )r`   rr   )r`   rk   )rW   rX   rY   rq   r   r   r[   r\   r]   ri   ri      sT        A A A A
$ 
$ 
$ 
$     r\   ri   reasonmessagesIterable[Message]r   Optional[str]c                  K   | D ]@}	 |                                  d {V  # t          $ r}|j        dk    rY d }~8 d }~ww xY wd S )Ni'  )deleter   code)r   r   mexcs       r]   _single_delete_strategyr      s        	((** 	 	 	x5   	 s   #
A>>Ad   T)limitcheckbeforeafteraroundoldest_firstbulkr   channel-Union[Thread, TextChannel, VocalGuildChannel]r   Optional[int]r   Callable[[Message], bool]r   Optional[SnowflakeTime]r   r   r   Optional[bool]r   boolr`   List[Message]c               >  K   |t           u rd }|                     |||||          }	g }
d}t          t          j                    dz
  dz  dz
            dz  }|r| j        nt
          }|	2 3 d {V }|dk    r9|
d	d          } |||
           d {V  d}t          j        d           d {V  |j        	                                s` ||          sl|j
        |k     rT|dk    r!|
d                                          d {V  n$|dk    r|
| d          } |||
           d {V  d}t
          }|dz  }|
                    |           6 |dk    r|
| d          } |||
           d {V  n&|dk    r |
d                                          d {V  |
S )Nc                    dS NTr[   )r   s    r]   <lambda>z_purge_helper.<locals>.<lambda>   s    $ r\   )r   r   r   r   r   r   i u g     @@l    0E*   r   ir   r   rt   )MISSINGhistoryinttimedelete_messagesr   asynciosleeptypeis_deletableidr   append)r   r   r   r   r   r   r   r   r   rj   retcountminimum_timestrategymessage	to_deletes                   r]   _purge_helperr      sX      U6UajpqqHCE	&776AMQRRVXXL*.Kw&&4KH!       gC<<DEE
I(9V4444444444E-"""""""""|((** 	uW~~ 	:$$zz"gnn&&&&&&&&&&!L	hy8888888888E.H


73 "8 zzL	hy00000000000	!"gnnJs   +Ec                      e Zd ZU dZded<   dS )r-   aM  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.
    r   r   N)rW   rX   rY   __doc__rZ   r[   r\   r]   r-   r-      s%           GGGGGr\   c                      e Zd ZU 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edd            Zedd            Z	edd            Z
edd            Zedd            ZddZdS )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. This is a legacy concept that is no longer used.
    global_name: Optional[:class:`str`]
        The user's global nickname.
    bot: :class:`bool`
        If the user is a bot account.
    system: :class:`bool`
        If the user is a system account.
    ra   namediscriminatorr   global_namer   botsystemr`   c                    t           )z.:class:`str`: Returns the user's display name.NotImplementedErrorrc   s    r]   display_namezUser.display_name  
     "!r\   c                    t           )zI:class:`str`: Returns a string that allows you to mention the given user.r   rc   s    r]   mentionzUser.mention  r   r\   Optional[Asset]c                    t           )zbOptional[:class:`~discord.Asset`]: Returns an Asset that represents the user's avatar, if present.r   rc   s    r]   avatarzUser.avatar#  r   r\   c                    t           )zOptional[:class:`~discord.Asset`]: Returns an Asset that represents the user's avatar decoration, if present.

        .. versionadded:: 2.4
        r   rc   s    r]   avatar_decorationzUser.avatar_decoration(  
     "!r\   r   c                    t           )zOptional[:class:`int`]: Returns an integer that represents the user's avatar decoration SKU ID, if present.

        .. versionadded:: 2.4
        r   rc   s    r]   avatar_decoration_sku_idzUser.avatar_decoration_sku_id0  r   r\   r9   c                    t           )zE:class:`~discord.Asset`: Returns the default avatar for a given user.r   rc   s    r]   default_avatarzUser.default_avatar8  r   r\   c                    t           )z:class:`~discord.Asset`: Returns the user's display avatar.

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

        .. versionadded:: 2.0
        r   rc   s    r]   display_avatarzUser.display_avatar=  s
     "!r\   r   r?   c                    t           )aD  Checks if the user is mentioned in the specified message.

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

        Returns
        -------
        :class:`bool`
            Indicates if the user is mentioned in the message.
        r   )rd   r   s     r]   mentioned_inzUser.mentioned_inG  s
     "!r\   Nrf   )r`   r   )r`   r   )r`   r9   )r   r?   r`   r   )rW   rX   rY   r   rZ   propertyr   r   r   r   r   r   r   r   r[   r\   r]   r.   r.      sG         0 IIIIIILLL" " " X" " " " X" " " " X" " " " X" " " " X" " " " X" " " " X"" " " " " "r\   r.   c                  ,    e Zd ZU dZdZded<   ded<   dS )r/   ai  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.
    r[   r   r   r8   meN)rW   rX   rY   r   	__slots__rZ   r[   r\   r]   r/   r/   W  s3           IGGGNNNNNr\   r/   c                  :    e Zd ZdZdZdZddZdd	ZddZddZ	dS )_Overwritesr   allowdenyr   r   r   dataPermissionOverwritePayloadr`   rl   c                    t          |d                   | _        t          |                    dd                    | _        t          |                    dd                    | _        |d         | _        d S )Nr   r   r   r   r   )r   r   getr   r   r   )rd   r   s     r]   rq   z_Overwrites.__init__s  s\    4:dhhw2233
TXXfa0011	#'<			r\   c                l    | j         t          | j                  t          | j                  | j        dS )Nr   )r   ra   r   r   r   rc   s    r]   _asdictz_Overwrites._asdicty  s1    '__	NNI	
 
 	
r\   r   c                    | j         dk    S )Nr   r   rc   s    r]   is_rolez_Overwrites.is_role      yA~r\   c                    | j         dk    S )Nr   r   rc   s    r]   	is_memberz_Overwrites.is_member  r   r\   N)r   r   r`   rl   )r`   r   r`   r   )
rW   rX   rY   r   ROLEMEMBERrq   r   r   r   r[   r\   r]   r   r   m  ss        /IDF0 0 0 0
 
 
 
        r\   r   c            
         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<   erdpdZdqdZe	drd            Z
dsdZ	 	 dtdud$Zdvd'Zdwd(Ze	dxd*            Ze	dqd+            Ze	dqd,            Ze	dyd.            Zdzd2Ze	d{d4            Ze	d|d6            Ze	d}d7            Zd~d:Zdd<Zdd=dd>Zed?d?d@ddD            Zed?d=ddG            Zedd@ddIZddddJddNZddddJddOZeeeeedPddU            Z eeeeedPddW            Z eeeeedPddZ            Z eeeeedPdd\            Z dd^Z dd_d_dd`ddddda	ddmZ!ddoZ"dS )r0   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.
    r[   r   r   ra   r   r;   guildr   r   positionr   category_idr:   _statezList[_Overwrites]_overwritesstater   GuildChannelPayloadc                   d S rn   r[   )rd   r   r   r   s       r]   rq   zGuildChannel.__init__  s      r\   r`   c                    | j         S rn   )r   rc   s    r]   __str__zGuildChannel.__str__  s
    yr\   c                    t           rn   r   rc   s    r]   _sorting_bucketzGuildChannel._sorting_bucket  s    !!r\   Dict[str, Any]rl   c                    t           rn   r   )rd   r   r   s      r]   _updatezGuildChannel._update      !!r\   NF	parent_idOptional[Any]lock_permissionsr   r   r   c                 K   dk     rt          d          | j        j        }| j        fd| j        j        D             }|                    d            	 |                    |            t          fdt          |          D             t          |                    }|                    ||            n# t           $ r Y d S w xY wg }t          |          D ]T\  }}	|	j        |d}
|t          ur'|	j        | j        k    r|
                    ||           |                    |
           U|                    | j        j        ||	           d {V  d S )
Nr   z'Channel position cannot be less than 0.c                *    g | ]}|j         k    |S r[   )r   )ry   cbuckets     r]   r{   z&GuildChannel._move.<locals>.<listcomp>  s'    'f'f'fa!J[_eJeJeJeJeJer\   c                    | j         S rn   r   r  s    r]   r   z$GuildChannel._move.<locals>.<lambda>  s    AJ r\   keyc              3  8   K   | ]\  }}|j         k    |V  d S rn   r  )ry   ir  r   s      r]   	<genexpr>z%GuildChannel._move.<locals>.<genexpr>  s3      VV1qzX?U?U!?U?U?U?UVVr\   r   r   r   r   r   )
ValueErrorr   httpr   r   channelssortremovenext	enumerateleninsertr   rg   updater   bulk_channel_update)rd   r   r   r   r   r  r  indexpayloadr  dr  s    `         @r]   _movezGuildChannel._move  s      a<<FGGG{%'f'f'f'f4:3F'f'f'f..///		)OOD!!!
 VVVV	((;(;VVVX[\dXeXeffEOOE4((((  	 	 	FF	 !(++ 	 	HE1'(t ? ?A
**qttw9?OPPPNN1&&tz}gf&MMMMMMMMMMMs   B? ?
CCoptionsOptional[ChannelPayload]c                  K   	 |                     d          }|o|j        }n# t          $ r
 t          }Y nw xY w	 |                     d          |d<   n# t          $ r Y nw xY w	 |                     d          |d<   n# t          $ r Y nw xY w	 |                     d          }|d nt	          |          |d<   n# t          $ r Y nw xY w	 |                     d          }t          |          |d<   n# t          $ r Y nw xY w|                     dd	          }	 |                     d
          }|                     ||||           d {V  n# t          $ r |t          ur8|r0| j                            |          }	|	rd |	j	        D             |d<   ||d<   n>|r<| j
        5| j                            | j
                  }	|	rd |	j	        D             |d<   Y nw xY w|                    dd           }
|
g }|
                                D ]\  }}t          |t                    st          d|j        j                   |                                \  }}|j        |j        |j        d}t          |t(                    rt*          j        |d<   nNt          |t.                    r*|j        t(          u rt*          j        nt*          j        |d<   nt*          j        |d<   |                    |           ||d<   	 |d         }t          |t6                    st          d          |j        |d<   n# t          $ r Y nw xY w	 |                     d          }| j        j                            || j        |           d {V  n# t          $ r Y nw xY w|r% | j        j        j        | j        fd|i| d {V S d S )Ncategoryslowmode_delayrate_limit_per_userdefault_thread_slowmode_delay"default_thread_rate_limit_per_user
rtc_regionvideo_quality_modesync_permissionsFr   )r   r   r   c                6    g | ]}|                                 S r[   r   ry   r  s     r]   r{   z&GuildChannel._edit.<locals>.<listcomp>  s     ;f;f;fAAIIKK;f;f;fr\   permission_overwritesr   c                6    g | ]}|                                 S r[   r(  r)  s     r]   r{   z&GuildChannel._edit.<locals>.<listcomp>  s     7b7b7b		7b7b7br\   
overwritesz&Expected PermissionOverwrite received )r   r   r   r   z&type field must be of type ChannelTypestatus)
channel_idr   r   ) popr   KeyErrorrg   ra   r   r  r   get_channelr   r   r   items
isinstancer    	TypeError	__class__rW   pairvaluer"   r   r   r   r   r   r   r   r   r  edit_voice_channel_statusedit_channel)rd   r  r   parentr   r$  r%  r   r   r  r,  permstargetpermr   r   r  ch_typer-  s                      r]   _editzGuildChannel._edit  s     	-[[,,F ,69II  	# 	# 	#"III	#
	-4[[9I-J-JG)** 	 	 	D		<CKKHg<h<hG899 	 	 	D		T \22J -7,>DDC
OOGL!!  	 	 	D	
	D!(-A!B!B -00B,C,CG())  	 	 	D	
 #;;'95AA	n{{:..H **XM]fl*mmmmmmmmmm  	c 	c 	c
**# g#z55i@@H g;f;fQYQe;f;f;f 78'0$$! cd&6&B  :11$2BCC c7b7bXMa7b7b7bG34	c  [[t44
!E * 0 0 2 2 & &!$(;<< h#$fT^Md$f$fggg"iikkt"[ J )  fd++ 9&1&6GFOO// 9:@+:M:Mk&6&6S^SeGFOO&1&8GFOW%%%%/4G+,	,foG g{33 J HIII%mGFOO  	 	 	D		h[[**F +"<<VPTPW`f<gggggggggg  	 	 	D	
  	Z6)6twYYvYQXYYYYYYYYY	Z 	Zs   # 77A 
A! A!%A> >
B
BB; ;
CCC4 4
D DE B	GG?L6 6
MMN
 

NNc                ^   g | _         d}| j        j        }t          |                    dg                     D ]Q\  }}t          |          }| j                             |           |j        t
          j        k    rD|j        |k    r|}R| j         }|r|d         ||         c||<   |d<   d S d S )Nr   r*  )	r   r   r   r  r   r   r   r   r   )rd   r   everyone_indexeveryone_idr  
overridden	overwritetmps           r]   _fill_overwriteszGuildChannel._fill_overwrites=  s    jm!*4884KR+P+P!Q!Q 	' 	'E:#J//I##I...~!333|{** "'  	F*-a&#n2E'CQ	F 	Fr\   
List[Role]c                    g }| j         }t          d | j                  D ]m}|                    |j                  }|t          j        |          }|j                            |j        |j	                   |
                    |           n|S )zList[:class:`~discord.Role`]: Returns a list of roles that have been overridden from
        their default values in the :attr:`~discord.Guild.roles` attribute.c                *    |                                  S rn   r   )os    r]   r   z,GuildChannel.changed_roles.<locals>.<lambda>\  s    !))++ r\   )r   filterr   get_roler   copypermissionshandle_overwriter   r   r   )rd   r   grD  roles        r]   changed_roleszGuildChannel.changed_rolesV  s     J 5 5t7GHH 	 	I::il++D|9T??D--ioy~NNNJJt
r\   c                    d| j          dS )z@:class:`str`: The string that allows you to mention the channel.z<#>r   rc   s    r]   r   zGuildChannel.mentionf  s     DGr\   c                0    d| j         j         d| j         S )zr:class:`str`: Returns a URL that allows the client to jump to the channel.

        .. versionadded:: 2.0
        zhttps://discord.com/channels//)r   r   rc   s    r]   jump_urlzGuildChannel.jump_urlk  s!     Itz}HHtwHHHr\   r   c                4    t          j        | j                  S )zG:class:`datetime.datetime`: Returns the channel's creation time in UTC.)r+   snowflake_timer   rc   s    r]   
created_atzGuildChannel.created_ats  s     #DG,,,r\   objUnion[Role, User, Object]r    c                V   t          |t                    rd }nt          |t                    rd }nd }t          || j                  D ]Q}|j        |j        k    r?t          |j                  }t          |j                  }t          j
        ||          c S Rt                      S )a  Returns the channel-specific overwrites for a member or a role.

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

        Returns
        ---------
        :class:`~discord.PermissionOverwrite`
            The permission overwrites for this object.
        c                *    |                                  S rn   )r   ps    r]   r   z-GuildChannel.overwrites_for.<locals>.<lambda>  s    !++-- r\   c                *    |                                  S rn   rJ  ra  s    r]   r   z-GuildChannel.overwrites_for.<locals>.<lambda>  s    !))++ r\   c                    dS r   r[   ra  s    r]   r   z-GuildChannel.overwrites_for.<locals>.<lambda>  s    $ r\   )r3  r.   r"   rL  r   r   r!   r   r   r    	from_pair)rd   r]  	predicaterD  r   r   s         r]   overwrites_forzGuildChannel.overwrites_forx  s     c4   	'//IIT"" 	'--II&I	4+;<< 	B 	BI|sv%%#IO44"9>22*4UDAAAAA &
 #$$$r\   6Dict[Union[Role, Member, Object], PermissionOverwrite]c                   i }| j         D ]}t          |j                  }t          |j                  }t	          j        ||          }d}|                                r | j                            |j	                  }n3|
                                r| j                            |j	                  }|8|                                rt          nt          }t          |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`.

        .. versionchanged:: 2.0
            Overwrites can now be type-aware :class:`~discord.Object` in case of cache lookup failure

        Returns
        --------
        Dict[Union[:class:`~discord.Role`, :class:`~discord.Member`, :class:`~discord.Object`], :class:`~discord.PermissionOverwrite`]
            The channel's permission overwrites.
        N)r   r   )r   r!   r   r   r    re  r   r   rM  r   r   
get_memberr"   r.   r   )rd   r   owr   r   rD  r<  target_types           r]   r,  zGuildChannel.overwrites  s      " 	$ 	$B))Erw''D+5eTBBIFzz|| 6,,RU33 6..ru55~&(jjll<dd25{;;;#CKK
r\   Optional[CategoryChannel]c                @    | j                             | j                  S )zOptional[:class:`~discord.CategoryChannel`]: The category this channel belongs to.

        If there is no category then this is ``None``.
        )r   r1  r   rc   s    r]   r  zGuildChannel.category  s     z%%d&6777r\   c                    | j         dS | j                            | j                   }t          |o|j        | j        k              S )z:class:`bool`: Whether or not 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
        NF)r   r   r1  r   r,  )rd   r  s     r]   permissions_syncedzGuildChannel.permissions_synced  sG     #5:))$*:;;HG!4!GHHHr\   baser!   c                    |j         sd|_        d|_        d|_        d|_        |j        s+t          j                    }|xj        |j         z  c_        d S d S NF)	send_messagessend_tts_messagesmention_everyoneembed_linksattach_filesread_messagesr!   all_channelr7  )rd   rq  denieds      r]   _apply_implicit_permissionsz(GuildChannel._apply_implicit_permissions  sl     ! 	&%*D"$)D!$D %D ! 	( ,..FJJ6<-'JJJJ	( 	(r\   Union[Member, Role]c               T   | j         j        j        k    rt          j                    S | j         j        }|=| j        j        j        k    rt          j        d          S t          j	                    S t          |j
        j                  }t          t                    r|xj        j        z  c_        |j        rt          j                    S 	 | j        d         }|j        | j         j        k    r!|                    |j        |j                   n# t(          $ r Y nw xY w                                r|S t-          j        fd| j                  }| |                    |j        |j                   |S j        }| j         j        }|D ]$} ||          }	|	|xj        |	j        z  c_        %|j        rt          j                    S 	 | j        d         }|j        | j         j        k    r1|                    |j        |j                   | j        dd         }
n| j        }
n# t(          $ r
 | j        }
Y nw xY wd}d}|
D ]D}|                                r.|                    |j                  r||j        z  }||j        z  }E|                    ||           |
D ]I}|                                r3|j        j        k    r#|                    |j        |j                    nJ                                r!|xj        t          j                    z  c_        |S )ab  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
        - Implicit permissions
        - Member timeout
        - User installed app

        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.

        .. versionchanged:: 2.0
            ``obj`` parameter is now positional-only.

        .. versionchanged:: 2.4
            User installed apps are now taken into account.
            The permissions returned for a user installed app mirrors the
            permissions Discord returns in :attr:`~discord.Interaction.app_permissions`,
            though it is recommended to use that attribute instead.

        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.
        NT)in_guildr   )r   r   c                N    | j         t          j        k    o| j        j        k    S rn   )r   r   r   r   )rk  r]  s    r]   r   z.GuildChannel.permissions_for.<locals>.<lambda>8  s     bg9I.I.]beWZW]o r\   r   )r   owner_idr   r!   alldefault_roler   self_id_user_installed_permissionsnonerO  r7  r3  r"   _permissionsadministratorr   rP  r   r   
IndexError
is_defaultr+   find_rolesrM  r   hasr   is_timed_out_timeout_mask)rd   r]  defaultrq  maybe_everyonerD  rolesrM  role_idrR  remaining_overwritesdeniesallowss    `           r]   permissions_forzGuildChannel.permissions_for  sr   z :#&((?$$$*)?{"cf,,">MMMM"')))7.455 c4   	JJ#**JJ! )"(((!%!1!!4!$
55))0D>K^)___    ~~ 
#]#]#]#]_c_oppI$%%ioy~FFFK
:&  	0 	0G8G$$D

d//

  	%?$$$	4!-a0N DJM11%%N,@~GZ%[[['+'7';$$'+'7$ 	4 	4 	4#'#3   	4  . 	* 	*I  "" *uyy'>'> *).()/)F888 . 	 	I""$$ )?)?%%IO).%QQQ 	6 JJ+3555JJs&   AD 
D$#D$AH. .IIr   c               b   K   | j         j                            | j        |           d{V  dS )aF  |coro|

        Deletes the channel.

        You must have :attr:`~discord.Permissions.manage_channels` to do 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.
        r   N)r   r  delete_channelr   )rd   r   s     r]   r   zGuildChannel.deletep  s@      , k--dgf-EEEEEEEEEEEr\   .)rD  r   r<  rD  0Optional[Union[PermissionOverwrite, _Undefined]]c               
   K   d S rn   r[   )rd   r<  rD  r   s       r]   set_permissionszGuildChannel.set_permissions         sr\   rO  "Unpack[_PermissionOverwriteKwargs]c               
   K   d S rn   r[   )rd   r<  r   rO  s       r]   r  zGuildChannel.set_permissions  r  r\   r   c               2  K   | j         j        }t          |t                    rt          j        }n1t          |t                    rt          j        }nt          d          |t          u rTt          |          dk    rt          d          	 t          d	i |}nF# t          t          f$ r t          d          w xY wt          |          dk    rt          d          |*|                    | j        |j        |           d{V  dS t          |t                    rh|                                \  }}|                    | j        |j        t#          |j                  t#          |j                  ||           d{V  dS t          d          )
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 :attr:`~discord.Permissions.manage_roles` to do 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)

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


        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.
        TypeError
            The ``overwrite`` parameter was invalid or the target type was not
            :class:`~discord.Role` or :class:`~discord.Member`.
        ValueError
            The ``overwrite`` parameter and ``positions`` parameters were both
            unset.
        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.Nr   z Invalid overwrite type provided.r[   )r   r  r3  r.   r   r   r"   r   r  rg   r  r    r4  delete_channel_permissionsr   r6  edit_channel_permissionsra   r7  )	rd   r<  rD  r   rO  r  	perm_typer   r   s	            r]   r  zGuildChannel.set_permissions  s     h {fd## 	O#*II%% 	O#(IIMNNN
"";1$$ !9:::S/>>+>>			* S S S QRRRS ;!## MNNN11$'69V1TTTTTTTTTTT	#677 	@%NN,,MUD//C$4$4c$*ooyY_ 0            >???s   B !B<)r   r  r   
base_attrsr  r5   c               J  K   d | j         D             |d<   | j        |d<   |p| j        |d<   |
|j        |d<   | j        j        }| j        } | j        j        j        || j	        j
        fd|i| d {V } || j        | j        |          }|| j        j        |j        <   |S )Nc                6    g | ]}|                                 S r[   r(  )ry   xs     r]   r{   z,GuildChannel._clone_impl.<locals>.<listcomp>  s     .U.U.Uqqyy{{.U.U.Ur\   r*  r   r   r   )r   r   r   )r   r   r   r   r   r5  r   r  create_channelr   r7  	_channels)	rd   r  r   r  r   guild_idclsr   r]  s	            r]   _clone_implzGuildChannel._clone_impl  s       /V.UDDT.U.U.U
*+"&"2
;!.TY
6&.kJ{#:=n4T[%4XtyllW]lakllllllllc4:DAAA (+
SV$
r\   c                  K   t           )a#  |coro|

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

        You must have :attr:`~discord.Permissions.manage_channels` 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.
        category: Optional[:class:`~discord.CategoryChannel`]
            The category the new channel belongs to.
            This parameter is ignored if cloning a category channel.

            .. versionadded:: 2.5
        reason: Optional[:class:`str`]
            The reason for cloning this channel. Shows up on the audit log.

        Raises
        -------
        ~discord.Forbidden
            You do not have the proper permissions to create this channel.
        ~discord.HTTPException
            Creating the channel failed.

        Returns
        --------
        :class:`.abc.GuildChannel`
            The channel that was created.
        r   )rd   r   r  r   s       r]   clonezGuildChannel.clone#  s      R "!r\   )offsetr  r&  r   	beginningr  Optional[Snowflake]r&  c               
   K   d S rn   r[   )rd   r  r  r  r&  r   s         r]   movezGuildChannel.moveN         sr\   endc               
   K   d S rn   r[   )rd   r  r  r  r&  r   s         r]   r  zGuildChannel.moveY  r  r\   r   r-   c               
   K   d S rn   r[   )rd   r   r  r  r&  r   s         r]   r  zGuildChannel.moved  r  r\   r   c               
   K   d S rn   r[   )rd   r   r  r  r&  r   s         r]   r  zGuildChannel.moveo  r  r\   kwargsc                r   K   |sdS |                     d          |                     d          }}|                     d          |                     d          c|                     dd          }t          d ||fD                       d	k    rt          d
           j        |                     dt                    t          dfvr!j        fd j        j        D             }n fd j        j        D             }|                    d            	 |	                                n# t          $ r Y nw xY wd}|rd}ni|rt          |          }nWr*t          fdt          |          D             d          }n+r)t          fdt          |          D             d          }|t          d          |                    t          ||z   d                      g }|                     dd          }|                     d          }	t          |          D ]T\  }}
|
j        |d}t          ur'|
j         j        k    r|                    |           |                    |           U j        j                             j        j        ||	           d{V  dS )a9
  |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 :attr:`~discord.Permissions.manage_channels` to do this.

        .. note::

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

        .. versionadded:: 1.7

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

        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`
            Whether to move the channel before the given channel.
            This is mutually exclusive with ``beginning``, ``end``, and ``after``.
        after: :class:`~discord.abc.Snowflake`
            Whether to move the channel after the given 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
        -------
        ValueError
            An invalid position was given.
        TypeError
            A bad mix of arguments were passed.
        Forbidden
            You do not have permissions to move the channel.
        HTTPException
            Moving the channel failed.
        Nr  r  r   r   r  r   c              3  4   K   | ]}t          |          V  d S rn   )r   )ry   as     r]   r
  z$GuildChannel.move.<locals>.<genexpr>  s(      @@1tAww@@@@@@r\   r   z8Only one of [before, after, end, beginning] can be used.r  c                @    g | ]}|j         k    r|j        k    |S r[   r   r   )ry   chr  r   s     r]   r{   z%GuildChannel.move.<locals>.<listcomp>  s@       %//Ni//  0//r\   c                J    g | ]}|j         k    r|j        j        k    | S r[   r  )ry   r  r  rd   s     r]   r{   z%GuildChannel.move.<locals>.<listcomp>  sC       %//Nd&666  766r\   c                    | j         | j        fS rn   )r   r   r  s    r]   r   z#GuildChannel.move.<locals>.<lambda>  s    QZ$6 r\   r  c              3  B   K   | ]\  }}|j         j         k    |V  d S rn   rV  )ry   r	  r  r   s      r]   r
  z$GuildChannel.move.<locals>.<genexpr>  s5      QQ1qtvy?P?P!?P?P?P?PQQr\   c              3  H   K   | ]\  }}|j         j         k    |d z   V  dS )r   NrV  )ry   r	  r  r   s      r]   r
  z$GuildChannel.move.<locals>.<genexpr>  s9      TTDAq1458CSCS!a%CSCSCSCSTTr\   z+Could not resolve appropriate move positionr&  Fr   r  r  r   )r   sumr4  r   r   r   r   r  r  r  r  r  r  r  r  maxr  r   r   r  r  )rd   r  r  r  r  r  r  r  r   r   r   r  r   r   r  r   s   `           @@@@r]   r  zGuildChannel.movez  sA     @  	FK00&**U2C2C3	

8,,fjj.A.AHa((@@C ?@@@@@1DDVWWW%JJz733	 WdO++!I    *-  HH    *-  H 	66777	OOD!!!! 	 	 	D	  	\EE 	\MMEE 	\QQQQ	((;(;QQQSWXXEE 	\TTTTIh,?,?TTTVZ[[E=JKKKUV^a00$777/1!::&8%@@H%%'11 	 	NE7.5je'L'LA''GJ$',A,A9?OPPPNN1k224:='RX2YYYYYYYYYYYs   &D< <
E	E	r   T)	r   max_agemax_uses	temporaryuniquerl  target_usertarget_application_idguestr  r  r  r  rl  Optional[InviteTarget]r  Optional[User]r  r  r$   c       	        R  K   |t           j        u rt          d          d}
|	rt          j        d          }
d|
_        | j        j                            | j	        ||||||r|j
        nd|r|j	        nd||
r|
j
        nd
  
         d{V }t          j        || j                  S )a*  |coro|

        Creates an instant invite from a text or voice channel.

        You must have :attr:`~discord.Permissions.create_instant_invite` 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 :attr:`.InviteTarget.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 :attr:`.InviteTarget.embedded_application`.

            .. versionadded:: 2.0
        guest: :class:`bool`
            Whether the invite is a guest invite.

            .. versionadded:: 2.6

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

        ~discord.NotFound
            The channel that was passed is a category or an invalid channel.

        Returns
        --------
        :class:`~discord.Invite`
            The invite that was created.
        z0Cannot create invite with an unknown target typeNr   T)	r   r  r  r  r  rl  target_user_idr  flags)r   r   )r   unknownr  r,   _from_valuer  r   r  create_inviter   r7  r$   from_incomplete)rd   r   r  r  r  r  rl  r  r  r  r  r   s               r]   r  zGuildChannel.create_invite  s      H ,...OPPP'+ 	+A..EEK[%33G-8B))d-8B;>>d"7!&0%++D 4 
 
 
 
 
 
 
 
 %4t{CCCCr\   List[Invite]c                    K    j         j                             j                   d{V } j         fd|D             S )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.

        Raises
        -------
        ~discord.Forbidden
            You do not have proper permissions to get the information.
        ~discord.HTTPException
            An error occurred while fetching the information.

        Returns
        -------
        List[:class:`~discord.Invite`]
            The list of invites that are currently active.
        Nc                6    g | ]}t          |           S ))r   r   r   r   r#   )ry   inviter   rd   r   s     r]   r{   z(GuildChannel.invites.<locals>.<listcomp>k  s+    ___PVUUKKK___r\   )r   r  invites_from_channelr   r   )rd   r   r   r   s   ` @@r]   inviteszGuildChannel.invitesT  sc      ( Z44TW========
______Z^____r\   )r   r:   r   r;   r   r   rf   )r`   r   )r   r;   r   r   r`   rl   rs  )
r   r   r   r   r   r   r   r   r`   rl   )r  r   r   r   r`   r  )r   r   r`   rl   )r`   rG  )r`   r   )r]  r^  r`   r    )r`   rh  )r`   rm  r   )rq  r!   r`   rl   )r]  r}  r`   r!   )r   r   r`   rl   )r<  r}  rD  r  r   r   r`   rl   )r<  r}  r   r   rO  r  r`   rl   )
r<  r}  rD  r   r   r   rO  r  r`   rl   )
r  r   r   r   r  rm  r   r   r`   r5   )r   r   r  rm  r   r   r`   r5   )r  r   r  r   r  r  r&  r   r   r   r`   rl   )r  r   r  r   r  r  r&  r   r   ra   r`   rl   )r   r-   r  r   r  r  r&  r   r   ra   r`   rl   )r   r-   r  r   r  r  r&  r   r   ra   r`   rl   )r  r   r`   rl   )r   r   r  r   r  r   r  r   r  r   rl  r  r  r  r  r   r  r   r`   r$   )r`   r  )#rW   rX   rY   r   r   rZ   r   rq   r   r   r   r   r  r?  rF  rS  r   rY  r\  rg  r,  r  rp  r|  r  r   r   r  rg   r  r  r   r  r  r  r[   r\   r]   r0   r0     s         . IGGGIIILLLMMM"""" dcccc    " " " X"" " " " $(!&	#N #N #N #N #NJ]Z ]Z ]Z ]Z~F F F F2    X    X I I I XI - - - X-% % % %:       X D 8 8 8 X8 I I I XI( ( ( (Q Q Q Qf 7; F F F F F F0 
 GJ #     X 
 !$	     X $ $p@ p@ p@ p@ p@ p@l #.2 $     4 #.2 $)" )" )" )" )" )"V 
 (/!( '     X 
 (/!(     X 
 (/!(     X 
 (/!(     X~Z ~Z ~Z ~ZF !%.2&*/3XD XD XD XD XD XDt` ` ` ` ` `r\   r0   c                     e Zd ZU dZdZded<   dZdZeddddddddd	d[d            Ze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+            Ze	 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`d1            Ze	 d]dddddddddddddd2dad3            Z	 dbd5d4d4d4d4d4d4d4d4d4d4d4d5d5d4d6dcdCZdddEZ	dedHZ
dId4d5dJdfdQZdId4d5dJdgdSZdTd4d4d4d4dUdhdYZd4S )ir1   a  An ABC that details the common operations on a model that can send messages.

    The following classes implement this ABC:

    - :class:`~discord.TextChannel`
    - :class:`~discord.VoiceChannel`
    - :class:`~discord.StageChannel`
    - :class:`~discord.DMChannel`
    - :class:`~discord.GroupChannel`
    - :class:`~discord.PartialMessageable`
    - :class:`~discord.User`
    - :class:`~discord.Member`
    - :class:`~discord.ext.commands.Context`
    - :class:`~discord.Thread`
    r[   r:   r   r`   MessageableChannelc                   K   t           rn   r   rc   s    r]   _get_channelzMessageable._get_channel  s      !!r\   .)filedelete_afternonceallowed_mentions	referencemention_authorsuppress_embedssilentr  r%   r  floatr  Union[str, int]r  r   r  0Union[Message, MessageReference, PartialMessage]r  r   viewrM   r  r  r?   c       	        
   K   d S rn   r[   )
rd   r  r  r  r  r  r  r  r  r  s
             r]   sendzMessageable.send         #r\   )filesr  r  r  r  r  r  r  r  Sequence[File]c       	        
   K   d S rn   r[   )
rd   r  r  r  r  r  r  r  r  r  s
             r]   r  zMessageable.send  r  r\   )ttsembedr  stickersr  r  r  r  r  r  r  r  pollcontentr   r  r  r>   r  *Sequence[Union[GuildSticker, StickerItem]]rL   r  rI   c               
   K   d S rn   r[   )rd   r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                  r]   r  zMessageable.send        $ #r\   )r  r  r  r  r  r  r  r  r  r  r  r  r  c               
   K   d S rn   r[   )rd   r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                  r]   r  zMessageable.send  r  r\   )r  embedsr  r  r  r  r  r  r  r  r  r  r  r  Sequence[Embed]c               
   K   d S rn   r[   )rd   r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                  r]   r  zMessageable.send  r  r\   )r  r  r  r  r  r  r  r  r  r  r  r  r  c               
   K   d S rn   r[   )rd   r  r  r  r  r  r  r  r  r  r  r  r  r  r  s                  r]   r  zMessageable.send  r  r\   NF)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  Optional[Embed]Optional[Sequence[Embed]]Optional[File]Optional[Sequence[File]]4Optional[Sequence[Union[GuildSticker, StickerItem]]]Optional[float]Optional[Union[str, int]]Optional[AllowedMentions]:Optional[Union[Message, MessageReference, PartialMessage]]r   Optional[BaseView]Optional[Poll]c               <  K   |                                   d{V }| j        }|t          |          nd}|j        }|d |D             }nt          }|4	 |                                }n%# t          $ r t          d          dw xY wt          }|r,t          |d          st          d|j	        j
                   |s|r*ddlm} |                    d          }||_        ||_        nt          }|	t!          j        d	          }	t%          ||||nt          ||nt          ||nt          ||nt          |	|
|||||||
          5 }|j                            |j        |           d{V }ddd           n# 1 swxY w Y   |                    ||          }|rC|                                s/|                                r|                    ||j                   |r|                    |           ||                    |           d{V  |S )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**.

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

        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.
        embeds: List[:class:`~discord.Embed`]
            A list of embeds to upload. Must be a maximum of 10.

            .. versionadded:: 2.0
        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: :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.
        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 referencing, this can be created using
            :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`.
            In the event of a replying reference, 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: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`]
            A Discord UI View to add to the message.

            .. 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_embeds: :class:`bool`
            Whether to suppress embeds for the message. This sends the message without any embeds if set to ``True``.

            .. versionadded:: 2.0
        silent: :class:`bool`
            Whether to suppress push and desktop notifications for the message. This will increment the mention counter
            in the UI, but will not actually send a notification.

            .. versionadded:: 2.2
        poll: :class:`~discord.Poll`
            The poll to send with this message.

            .. versionadded:: 2.4

        Raises
        --------
        ~discord.HTTPException
            Sending the message failed.
        ~discord.Forbidden
            You do not have the proper permissions to send the message.
        ~discord.NotFound
            You sent a message with the same nonce as one that has been explicitly
            deleted shortly earlier.
        ValueError
            The ``files`` or ``embeds`` list is not of the appropriate size.
        TypeError
            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`.

        Returns
        ---------
        :class:`~discord.Message`
            The message that was sent.
        Nc                    g | ]	}|j         
S r[   rV  )ry   stickers     r]   r{   z$Messageable.send.<locals>.<listcomp>~  s    )M)M)M'*)M)M)Mr\   zHreference parameter must be Message, MessageReference, or PartialMessage__discord_ui_view__z view parameter must be View not r   )MessageFlagsr   @   )r  r  r  r  r  r  r  r  message_referenceprevious_allowed_mentionsr  r  r  r  r  )paramsr   r   )delay)r  r   ra   r  r   to_message_reference_dictAttributeErrorr4  hasattrr5  rW   r   r  r  r  suppress_notificationssecretsrandbitsr&   r  send_messager   create_messageis_finishedis_dispatchable
store_viewr   r   )rd   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   previous_allowed_mentionsticker_idsreference_dictr  r  r  r   r   s                              r]   r  zMessageable.send  s     J ))++++++++")"5#g,,,4#(#9 )M)MH)M)M)MKK!K v!*!D!D!F!F! v v v jkkquuv %N 	Z&;<< 	ZXt~?VXXYYY 	f 	------ ,,Q//E$3E!+1E((E=$R((E&)w ,%%' ,%%'#/66W-,&>) 
 
 
 	L  00F0KKKKKKKKD#	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L& ""7">> 	+((** 	+t/C/C/E/E 	+T36*** 	LL#**<*000000000
s   A, ,B(F  FFr   c                     t          |           S )aU  Returns an asynchronous context manager that allows you to send a typing indicator to
        the destination for an indefinite period of time, or 10 seconds if the context manager
        is called using ``await``.

        Example Usage: ::

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

            await channel.send('Done!')

        Example Usage: ::

            await channel.typing()
            # Do some computational magic for about 10 seconds
            await channel.send('Done!')

        .. versionchanged:: 2.0
            This no longer works with the ``with`` syntax, ``async with`` must be used instead.

        .. versionchanged:: 2.0
            Added functionality to ``await`` the context manager to send a typing indicator for 10 seconds.
        r   rc   s    r]   typingzMessageable.typing  s    2 d||r\   r   r   c                  K   |                                   d{V }| j        j                            |j        |           d{V }| j                            ||          S )aD  |coro|

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

        Parameters
        ------------
        id: :class:`int`
            The message ID to look 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.

        Returns
        --------
        :class:`~discord.Message`
            The message asked for.
        Nr  )r  r   r  get_messager   r  )rd   r   r   r   s       r]   fetch_messagezMessageable.fetch_message  st      2 ))++++++++[%11'*bAAAAAAAA{))')EEEr\   2   r   r   r   r   r   r   r   r   rk   c                K   |                                   d {V }| j        }d}|Bt          |t                    r|nt	          j        |j                                                  nd }	 ||nt          ||          }|dk     rd S | j        j	        
                    |j        ||           d {V }	|	o|	d         }
|
r"||t          |
          z  }|
d         d         }t          |
          |k     s|	d         sd	}|rt          |
          }
d	}t          |
d
          D ]F\  }}|                    ||d                   }t	          j        |d                   |_        |W V  G||k     rd S 	)Nr(  Tr   )r.  r   r   r2  r   rU   has_morer   )startr   r  )r  r   r3  r   r+   r[  r   	isoformatminr  	pins_fromr  reversedr  r  
parse_time
_pinned_at)rd   r   r   r   r   r   	max_limitr   retriever   r2  r   r   r   s                 r]   __pinszMessageable.__pins  s      ))++++++++	 ! "&(33XVV9Mfi9X9Xcceee 	 	$)Myys5)7L7LH!||)33": 4        D *T']E .$SZZ'ERy- 5zzI%%T*-=% ( E%e1555  q#(#7#7aPYl#7#[#[%*%5an%E%E"y  A 	r\   ri   c               L    t          |                     |||                    S )a&	  Retrieves an :term:`asynchronous iterator` of the pinned messages in the channel.

        You must have :attr:`~discord.Permissions.view_channel` and
        :attr:`~discord.Permissions.read_message_history` in order to use this.

        .. versionchanged:: 2.6

            Due to a change in Discord's API, this now returns a paginated iterator instead of a list.

            For backwards compatibility, you can still retrieve a list of pinned messages by
            using ``await`` on the returned object. This is however deprecated.

        .. note::

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

        Examples
        ---------

        Usage ::

            counter = 0
            async for message in channel.pins(limit=250):
                counter += 1

        Flattening into a list: ::

            messages = [message async for message in channel.pins(limit=50)]
            # messages is now a list of Message...

        All parameters are optional.

        Parameters
        -----------
        limit: Optional[int]
            The number of pinned messages to retrieve. If ``None``, it retrieves
            every pinned message in the channel. Note, however, that this would
            make it a slow operation.
            Defaults to ``50``.

            .. versionadded:: 2.6
        before: Optional[Union[:class:`datetime.datetime`, :class:`.abc.Snowflake`]]
            Retrieve pinned messages before this time or snowflake.
            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.

            .. versionadded:: 2.6
        oldest_first: :class:`bool`
            If set to ``True``, return messages in oldest pin->newest pin order.
            Defaults to ``False``.

            .. versionadded:: 2.6

        Raises
        -------
        ~discord.Forbidden
            You do not have the permission to retrieve pinned messages.
        ~discord.HTTPException
            Retrieving the pinned messages failed.

        Yields
        -------
        :class:`~discord.Message`
            The pinned message with :attr:`.Message.pinned_at` set.
        r)  )ri   _Messageable__pins)rd   r   r   r   s       r]   pinszMessageable.pins"  s&    T T[[uVR^[__```r\   r   )r   r   r   r   r   r   r   AsyncIterator[Message]c                 K   d fd}d fd	}d fd}t          t                    r$t          t          j        d                    t          t                    r$t          t          j        d                    t          |t                    r"t          t          j        |                    }|du}	n|}	pt
          d}
|rO|t          d          |dk    rt          d          |dk    rdn|}||}}r	rfd}
n4rfd}
n,rfd}
n$|	r|}}rfd}
n|}}rt
          k    rfd}
                                  d{V 	 |dnt          |d          }|dk     rdS  ||||           d{V \  }}}|	rt          |          }|
rt          |
|          }d}t          |d          D ]$\  }} j                            |          W V  %|dk     rdS ) a	  Returns an :term:`asynchronous iterator` that enables receiving the destination's message history.

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

        Examples
        ---------

        Usage ::

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

        Flattening into a list: ::

            messages = [message async for message in channel.history(limit=123)]
            # messages is now a list of Message...

        All parameters are optional.

        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``.

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

        Yields
        -------
        :class:`~discord.Message`
            The message with the message data parsed.
        r4  r   r   r  r   r   c                   K   |sg d dfS |r|j         nd }j        j                            j         | |           d {V }|d dfS )Nr   )r   )r   r   r  	logs_from)r4  r   r   	around_idr   r   rd   s        r]   _around_strategyz-Messageable.history.<locals>._around_strategy  sk       #4{"%+5		I)33GJQZ3[[[[[[[[Dq= r\   r   c                   K   |r|j         nd }j        j                            j         | |           d {V }|r=||t	          |          z  }t          t          |d         d                             }|||fS )N)r   r   r   rV  r   r   r  r<  r  r   r   )r4  r   r   after_idr   r   rd   s        r]   _after_strategyz,Messageable.history.<locals>._after_strategy  s      #(2uxxdH)33GJPX3YYYYYYYYD 6$SYY&E#d1gdm"4"4555%%r\   r   c                   K   |r|j         nd }j        j                            j         | |           d {V }|r=||t	          |          z  }t          t          |d         d                             }|||fS )N)r   r   r   rV  r@  )r4  r   r   	before_idr   r   rd   s        r]   _before_strategyz-Messageable.history.<locals>._before_strategy  s      %+5		I)33GJQZ3[[[[[[[[D 8$SYY&E3tBx~#6#6777&&r\   F)highrV  TNz/history does not support around with limit=Nonee   z6history max limit 101 when specifying around parameterr   c                ^    j         t          | d                   cxk     o
j         k     nc S Nr   r   r   )r   r   r   s    r]   r   z%Messageable.history.<locals>.<lambda>  s1    ehQtW&I&I&I&I	&I&I&I&I r\   c                @    t          | d                   j        k     S rI  r   r   r   r   s    r]   r   z%Messageable.history.<locals>.<lambda>      c!D'llVY&> r\   c                @    j         t          | d                   k     S rI  rJ  r   r   s    r]   r   z%Messageable.history.<locals>.<lambda>  s    ehQtW&= r\   c                @    t          | d                   j        k     S rI  rL  rM  s    r]   r   z%Messageable.history.<locals>.<lambda>  rN  r\   c                @    t          | d                   j        k    S rI  rL  rP  s    r]   r   z%Messageable.history.<locals>.<lambda>  s    c!D'llUX&= r\   r   r   r  )r4  r   r   r  r   r   )r4  r   r   r  r   r   )r4  r   r   r  r   r   )r3  r   r   r+   time_snowflaker   r  r  r.  r0  rL  r  r   r  )rd   r   r   r   r   r   r>  rB  rE  reverserf  r   r   r4  r   r   raw_messager   s   ` ``             @r]   r   zMessageable.historyn  s!     F	! 	! 	! 	! 	! 	! 	!
	& 
	& 
	& 
	& 
	& 
	& 
	&
	' 
	' 
	' 
	' 
	' 
	' 
	' fh'' 	Iu3FGGGHHHFeX&& 	Fe25tDDDEEEEfh'' 	=u3F;;<<<F4'GG"G&	 	>} !RSSSs{{ !YZZZ !C<<CCUE.eH >% >IIIII		 >>>>>		 >====	 	>-ueH ?>>>>	.eH >-//====	))++++++++	#mssUCH!||'/x%'G'G!G!G!G!G!G!GD% &~~ /i..E&/a&8&8 T T"{k00{0SSSSSSSs{{'	r\   )r`   r  )r  r%   r  r  r  r  r  r   r  r  r  r   r  rM   r  r   r  r   r`   r?   )r  r  r  r  r  r  r  r   r  r  r  r   r  rM   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  rL   r  r   r  r   r  rI   r`   r?   )r  r   r  r   r  r>   r  r  r  r  r  r  r  r  r  r   r  r  r  r   r  rL   r  r   r  r   r  rI   r`   r?   )r  r   r  r   r  r  r  r%   r  r  r  r  r  r  r  r   r  r  r  r   r  rL   r  r   r  r   r  rI   r`   r?   )r  r   r  r   r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r   r  rL   r  r   r  r   r  rI   r`   r?   rn   )"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  r	  r`   r?   )r`   r   )r   r   r`   r?   )r   r   r   r   r   r   r`   rk   )r   r   r   r   r   r   r`   ri   )r   r   r   r   r   r   r   r   r   r   r`   r9  )rW   rX   rY   r   r   rZ   r  r   r  r$  r'  r7  r8  r   r[   r\   r]   r1   r1   n  sf           I" " " "  !!$,/FI" #     X  !$!!$,/FI" #     X  "% ?B!!$,/FI" #!     X&  "%  #?B!!$,/FI" #!     X&  "% "%?B!!$,/FI" #!     X&  "% "% #?B!!$,/FI" #!     X* "&B !%,0#*.IM(,+/6:PT)-#' %#%B B B B B BH   6F F F F@  "*."1 1 1 1 1 1l  "*."Ja Ja Ja Ja Ja Ja^  #*.)-*.'+b b b b b b b br\   r1   c                  H    e Zd ZU dZdZded<   ddZdd	Zd
dedddddZ	dS )r2   zAn 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`
    r[   r:   r   r`   Tuple[int, str]c                    t           rn   r   rc   s    r]   _get_voice_client_keyz!Connectable._get_voice_client_key   r   r\   Tuple[int, int]c                    t           rn   r   rc   s    r]   _get_voice_state_pairz!Connectable._get_voice_state_pair#  r   r\   g      >@TF)timeout	reconnectr  	self_deaf	self_muter]  r  r^  r   r  "Callable[[Client, Connectable], T]r_  r`  r3   c                 K   |                                  \  }}| j        }|                    |          rt          d          |                                }	 ||	|           }
t          |
t                    st          d          |                    ||
           	 |
	                    ||||           d{V  nB# t          j        $ r0 	 |
                    d           d{V  n# t          $ r Y nw xY w w xY w|
S )a  |coro|

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

        This requires :attr:`~discord.Intents.voice_states`.

        Parameters
        -----------
        timeout: :class:`float`
            The timeout in seconds to wait the connection to complete.
        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:`~discord.VoiceProtocol`]
            A type that subclasses :class:`~discord.VoiceProtocol` to connect with.
            Defaults to :class:`~discord.VoiceClient`.
        self_mute: :class:`bool`
            Indicates if the client should be self-muted.

            .. versionadded:: 2.0
        self_deaf: :class:`bool`
            Indicates if the client should be self-deafened.

            .. versionadded:: 2.0

        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.

        Returns
        --------
        :class:`~discord.VoiceProtocol`
            A voice client that is fully connected to the voice server.
        z%Already connected to a voice channel.z1Type must meet VoiceProtocol abstract base class.)r]  r^  r_  r`  NT)force)rY  r   _get_voice_clientr   _get_clientr3  r(   r4  _add_voice_clientconnectr   TimeoutError
disconnect	Exception)rd   r]  r^  r  r_  r`  key_id_r   clientvoices              r]   rg  zConnectable.connect&  sV     f ..00	""6** 	K!"IJJJ""$$3vt$$%// 	QOPPP...	--9PYen-oooooooooo# 	 	 	&&T&2222222222    	 s0    C   C?C-,C?-
C:7C?9C::C?N)r`   rW  )r`   rZ  )r]  r  r^  r   r  ra  r_  r   r`  r   r`   r3   )
rW   rX   rY   r   r   rZ   rY  r\  r'   rg  r[   r\   r]   r2   r2     s           I" " " "" " " " 2=K K K K K K K Kr\   r2   )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   
__future__r   rN  r   r  r   r   r$  r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   objectr   r   context_managersr   enumsr   r   errorsr   r   mentionsr   rO  r    r!   rR  r"   r  r$   r  r%   r  r&   voice_clientr'   r(   r  r)   r*    r+   r  r,   r}   __all__r3   typing_extensionsr5   r6   rm  r7   userr8   assetr9   r   r:   r   r;   memberr<   r   r=   r  r>   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r  rI   threadsrJ   ui.viewrK   rL   rM   types.channelr   rN   ChannelPayloadr0   r   rO   types.guildrP   types.snowflakerQ   rR   PartialMessageableChannelr  SnowflakeTimerT   r   r_   rg   rZ   ri   r   r   r-   r.   r/   r   r1   r2   r[   r\   r]   <module>r     s    0 # " " " " "                                               ( * ) ) ) ) ) ) ) $ $ $ $ $ $ , , , , , , , , - - - - - - - - % % % % % % 9 9 9 9 9 9 9 9                   + + + + + + 4 4 4 4 4 4 4 4 . . . . . . . .              GC}%%% ,........      &&&&&&((((((BBBBBBBBBB                  3333333333                      877777 %k<vW`bt&t u8,FG+x/0M       
 -       
 *,,
           ( [_ 	 	 	 	 	 	 '.&*%)&*#' : : : : : :z        $ Z" Z" Z" Z" Z"9h Z" Z" Z"z       ,       6c` c` c` c` c` c` c` c`Lb
 b
 b
 b
 b
 b
 b
 b
J^ ^ ^ ^ ^( ^ ^ ^ ^ ^r\   