
    cjhJ                      d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZ ddlZddlmZ ddlmZ ddlmZ dd	lmZ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# 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/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5 ddlm6Z6 dZ7er~ddl8m9Z9m:Z: ddl;m<Z< ddl;m=Z> ddl?m@Z@mAZA ddlBmCZCmDZDmEZE ddlFmGZG ddlHmIZI ddlJmKZL ddlJmMZN dd lJmOZP dd!lJmQZR dd"lJmSZT dd#lJmUZV dd$lJmWZX dd%lJmYZZ dd&l[m\Z\ dd'l]m^Z^ dd(l_m`Z`maZambZb dd)lcmdZd  G d* d+e)      ZQ G d, d-ejp                  jz                  e)      Ze G d. d/ejp                  j                  ee      ZW G d0 d1ee      ZO G d2 d3ejp                  j                  ejp                  jz                  e)      Zh G d4 d5ejp                  j                  eh      ZY G d6 d7ejp                  j                  eh      ZU G d8 d9ejp                  jz                  e)      ZK e
d:d;<      Zi G d= d;ejp                  j                  e)      ZM G d> d?ejp                  j                  e)      Zj G d@ dAejp                  j                  e)      ZkdFdBZldFdCZmdFdDZndFdEZoy)Gae  
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MappingTypeVaroverload   )utils)Asset)Emoji)ChannelTypeEmbeddedActivityInviteTarget	SortOrderStagePrivacyLevelVideoQualityModeVoiceRegiontry_enum)ClientExceptionInvalidArgument)File)ChannelFlags)Invite)ArchivedThreadIterator)Hashable)Object)PartialEmoji	_EmojiTag)PermissionOverwritePermissions)StageInstance)Thread)MISSING)	TextChannelVoiceChannelStageChannel	DMChannelCategoryChannelGroupChannelPartialMessageableForumChannelForumTag)	SnowflakeSnowflakeTime)Guild)GuildChannel)Member
VoiceState)EmojiInputTypeMessagePartialMessage)Role)ConnectionState)r*   )r)   )r-   )r.   )GroupDMChannel)r(   )r&   )r'   )SnowflakeList)ThreadArchiveDuration)BaseUser
ClientUserUserWebhookc                  Z    e Zd ZdZdZdd	 	 	 	 	 	 	 ddZddZddZedd       Z	dd	Z
y
)r.   ad  Represents a forum tag that can be added to a thread inside a :class:`ForumChannel`
    .
        .. versionadded:: 2.3

        .. container:: operations

            .. describe:: x == y

                Checks if two forum tags are equal.

            .. describe:: x != y

                Checks if two forum tags are not equal.

            .. describe:: hash(x)

                Returns the forum tag's hash.

            .. describe:: str(x)

                Returns the forum tag's name.

        Attributes
        ----------
        id: :class:`int`
            The tag ID.
            Note that if the object was created manually then this will be ``0``.
        name: :class:`str`
            The name of the tag. Can only be up to 20 characters.
        moderated: :class:`bool`
            Whether this tag can only be added or removed by a moderator with
            the :attr:`~Permissions.manage_threads` permission.
        emoji: :class:`PartialEmoji`
            The emoji that is used to represent this tag.
            Note that if the emoji is a custom emoji, it will *not* have name information.
    )nameid	moderatedemojiF)rE   c                  || _         d| _        || _        |  t        |t              r|j                         | _        y t        |t              rt        j                  |      | _        y t        d|j                        )Nr   z4emoji must be a Emoji, PartialEmoji, or str and not )rC   rD   rE   
isinstancer    _to_partialrF   strr   from_str	TypeError	__class__)selfrC   rF   rE   s       B/var/www/html/venv/lib/python3.12/site-packages/discord/channel.py__init__zForumTag.__init__   ss     	(eY'**,DJs#%..u5DJOO&(     c           	     p    d| j                    d| j                  d| j                  d| j                   d	S )Nz<ForumTag id= name=z emoji=z moderated=>)rD   rC   rF   rE   rN   s    rO   __repr__zForumTag.__repr__   s=    77)6$))gdjj^;t~~N^^_a	
rQ   c                    | j                   S NrC   rU   s    rO   __str__zForumTag.__str__   s    yyrQ   c                  | j                  |       }|d   |_        t        |d         |_        |j	                  dd      |_        |d   xs d}t        j                  |d      xs d }t        j                  |||      |_
        |S )	NrC   rD   rE   F
emoji_name emoji_id)staterC   rD   )__new__rC   intrD   getrE   r   _get_as_snowflaker   
with_staterF   )clsr_   datarN   r\   r^   s         rO   	from_datazForumTag.from_data   s}    {{3L	d4j/+u5,'-2
**4<D!,,5zhW
rQ   c                    | j                   | j                  d| j                  j                         z  }| j                  r| j                  |d<   |S )N)rC   rE   rD   )rC   rE   rF   _to_forum_reaction_payloadrD   )rN   payloads     rO   to_dictzForumTag.to_dict   sI    II#
 JJ113#4
 77 GGGDMrQ   N)rC   rJ   rF   r5   rE   boolreturnNonerm   rJ   )r_   r9   rf   ForumTagPayloadrm   r.   )rm   zdict[str, Any])__name__
__module____qualname____doc__	__slots__rP   rV   rZ   classmethodrg   rk    rQ   rO   r.   r.   ]   s^    #J 5I FK#1>B	"
 	 		rQ   r.   c            	          e Zd ZdZ	 	 	 	 	 	 d!dZed"d       Zd#dZ	 	 	 	 	 	 d$dZed%d       Z	ed&d       Z
 ej                  ej                  j                  j                         d' fd       Zed(d	       Zed)d
       Zd*dZed+d       Zd,dZ ej                  ej                  j                  j,                        ddd	 	 	 	 	 d-d       Zdd	 	 	 	 	 d.dZdeddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d/dZd0dZddd	 	 	 	 	 	 	 d1dZdd	 	 	 	 	 d2dZd3dZd4dZddddd	 	 	 	 	 	 	 	 	 d5d Z xZ S )6_TextChannel)rC   rD   guildtopic_statensfwcategory_idpositionslowmode_delay_overwrites_typelast_message_iddefault_auto_archive_durationdefault_thread_slowmode_delaydefault_reaction_emojidefault_sort_orderavailable_tagsflagsc               \    || _         t        |d         | _        | j                  ||       y NrD   r|   ra   rD   _updaterN   r_   rz   rf   s       rO   rP   z_TextChannel.__init__   (     (-4:UD!rQ   c                     y)N)rD   rC   r   r}   r~   rw   rU   s    rO   _repr_attrsz_TextChannel._repr_attrs   s    >rQ   c                    | j                   D cg c]  }|t        | |      f }}dj                  d |D              }d| j                  j                   d| dS c c}w )N c              3  &   K   | ]	  }d |z    ywz%s=%rNrw   .0ts     rO   	<genexpr>z(_TextChannel.__repr__.<locals>.<genexpr>        5!'A+5   <rT   )r   getattrjoinrM   rq   )rN   valattrsjoineds       rO   rV   z_TextChannel.__repr__   sa    6:6F6FGs#wtS)*GG5u554>>**+1VHA66 Hs   Ac                P   || _         |d   | _        t        j                  |d      | _        |d   | _        |j                  dd      s|j                  d      | _        |j                  d      | _	        |j                  dd      | _
        |j                  d	d
      | _        |j                  dd      | _        |j                  d      | _        t        j                  |d      | _        t        j                   |j                  dd
            | _        | j%                  |       y y )NrC   	parent_idtype_invoke_flagFr{   r   r}   rate_limit_per_userr   r   i  "default_thread_rate_limit_per_userr   r   )rz   rC   r   rc   r~   r   poprb   r{   r   r}   r   r   r   r   r   _from_valuer   _fill_overwritesrN   rz   rf   s      rO   r   z_TextChannel._update   s    "
f	','>'>t['Qv,
xx.%)XXg%6DJ!%*!5DM"hhvu5DI'+xx0Eq'IDHL/ID. >BXX4>D. 05/F/F'0D  (4'?'?RS@T'UDJ!!$'! /rQ   c                6    t        t        | j                        S zThe channel's Discord type.)r   r   r   rU   s    rO   r   z_TextChannel.type   s     TZZ00rQ   c                6    t         j                  j                  S rX   )r   textvaluerU   s    rO   _sorting_bucketz_TextChannel._sorting_bucket  s    %%%rQ   c                   t         |   |      }t        j                         }|xj                  |j                   z  c_        |S rX   )superpermissions_forr"   voicer   rN   objbasedeniedrM   s       rO   r   z_TextChannel.permissions_for  s;    w&s+ ""$

v||m#
rQ   c                    | j                   j                  D cg c]   }| j                  |      j                  s|" c}S c c}w )z.Returns all members that can see this channel.)rz   membersr   read_messages)rN   ms     rO   r   z_TextChannel.members  s5      ::--Wa1E1Ea1H1V1VWWWs
    AAc                    | j                   j                  j                         D cg c]  }|j                  | j                  k(  r| c}S c c}w )zQReturns all the threads that you can see.

        .. versionadded:: 2.0
        )rz   _threadsvaluesr   rD   )rN   threads     rO   threadsz_TextChannel.threads  sI     **--446
477* 
 	
 
s   "Ac                    | j                   S zChecks if the channel is NSFW.r}   rU   s    rO   is_nsfwz_TextChannel.is_nsfw      yyrQ   c                h    | j                   r%| j                  j                  | j                         S dS a6  Fetches the last message from this channel in cache.

        The message might not be valid or point to an existing message.

        .. admonition:: Reliable Fetching
            :class: helpful

            For a slightly more reliable method of fetching the
            last message, consider using either :meth:`history`
            or :meth:`fetch_message` with the :attr:`last_message_id`
            attribute.

        Returns
        -------
        Optional[:class:`Message`]
            The last message in this channel or ``None`` if not found.
        Nr   r|   _get_messagerU   s    rO   last_messagez_TextChannel.last_message#  6    * ## KK$$T%9%9:	
 	
rQ   c                   K   t         w)zEdits the channel.)NotImplementedError)rN   optionss     rO   editz_TextChannel.edit<  s     !!s   	NrC   reasonc                  K   | j                  | j                  | j                  | j                  d||       d {   S 7 w)N)r{   r}   r   r   )_clone_implr{   r}   r   rN   rC   r   s      rO   clonez_TextChannel.clone@  sN      %%		'+':':
  & 
 
 	
 
s   :AAAr   c                 K   t        |t        t        f      st        |      }t        |      dk(  ryt        |      dk(  rJ|d   j                  }| j
                  j                  j                  | j                  ||       d{    yt        |      dkD  rt        d      |D cg c]  }|j                   }}| j
                  j                  j                  | j                  ||       d{    y7 rc c}w 7 wa  |coro|

        Deletes a list of messages. This is similar to :meth:`Message.delete`
        except it bulk deletes multiple messages.

        As a special case, if the number of messages is 0, then nothing
        is done. If the number of messages is 1 then single message
        delete is done. If it's more than two, then bulk delete is used.

        You cannot bulk delete more than 100 messages or messages that
        are older than 14 days old.

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

        Parameters
        ----------
        messages: Iterable[:class:`abc.Snowflake`]
            An iterable of messages denoting which ones to bulk delete.
        reason: Optional[:class:`str`]
            The reason for deleting the messages. Shows up on the audit log.

        Raises
        ------
        ClientException
            The number of messages to delete was more than 100.
        Forbidden
            You do not have proper permissions to delete the messages.
        NotFound
            If single delete, then the message was already deleted.
        HTTPException
            Deleting the messages failed.
        r   Nr   r   d   z0Can only bulk delete messages up to 100 messages
rH   listtuplelenrD   r|   httpdelete_messager   delete_messagesrN   messagesr   
message_idr   message_idss         rO   r   z_TextChannel.delete_messagesN       H (T5M2H~Hx=Ax=A&qknnJ++""11$'':f1UUUx=3!"TUU4<%=qadd%=%=kk..twwF.SSS V &>S0   BDC8"D(C:;7D2C?3D:Dr   FTlimitcheckbeforeafteraroundoldest_firstbulkr   c               n   K   t         j                  j                  | ||||||||	       d{   S 7 waG	  |coro|

        Purges a list of messages that meet the criteria given by the predicate
        ``check``. If a ``check`` is not provided then all messages are deleted
        without discrimination.

        You must have the :attr:`~Permissions.manage_messages` permission to
        delete messages even if they are your own.
        The :attr:`~Permissions.read_message_history` permission is
        also needed to retrieve message history.

        Parameters
        ----------
        limit: Optional[:class:`int`]
            The number of messages to search through. This is not the number
            of messages that will be deleted, though it can be.
        check: Callable[[:class:`Message`], :class:`bool`]
            The function used to check if a message should be deleted.
            It must take a :class:`Message` as its sole parameter.
        before: Optional[Union[:class:`abc.Snowflake`, :class:`datetime.datetime`]]
            Same as ``before`` in :meth:`history`.
        after: Optional[Union[:class:`abc.Snowflake`, :class:`datetime.datetime`]]
            Same as ``after`` in :meth:`history`.
        around: Optional[Union[:class:`abc.Snowflake`, :class:`datetime.datetime`]]
            Same as ``around`` in :meth:`history`.
        oldest_first: Optional[:class:`bool`]
            Same as ``oldest_first`` in :meth:`history`.
        bulk: :class:`bool`
            If ``True``, use bulk delete. Setting this to ``False`` is useful for mass-deleting
            a bot's own messages without :attr:`Permissions.manage_messages`. When ``True``, will
            fall back to single delete if messages are older than two weeks.
        reason: Optional[:class:`str`]
            The reason for deleting the messages. Shows up on the audit log.

        Returns
        -------
        List[:class:`.Message`]
            The list of messages that were deleted.

        Raises
        ------
        Forbidden
            You do not have proper permissions to do the actions required.
        HTTPException
            Purging the messages failed.

        Examples
        --------

        Deleting bot's messages ::

            def is_me(m):
                return m.author == client.user

            deleted = await channel.purge(limit=100, check=is_me)
            await channel.send(f'Deleted {len(deleted)} message(s)')
        r   Ndiscordabc_purge_messages_helper	rN   r   r   r   r   r   r   r   r   s	            rO   purgez_TextChannel.purge  J     J [[77% 8 

 

 
	
 

   ,535c                   K   ddl m} | j                  j                  j	                  | j
                         d{   }|D cg c]   } |j                  || j                        " c}S 7 0c c}w wab  |coro|

        Gets the list of webhooks from this channel.

        Requires :attr:`~.Permissions.manage_webhooks` permissions.

        Returns
        -------
        List[:class:`Webhook`]
            The webhooks for this channel.

        Raises
        ------
        Forbidden
            You don't have permissions to get the webhooks.
        r   r@   Nr_   webhookrA   r|   r   channel_webhooksrD   
from_staterN   rA   rf   ds       rO   webhooksz_TextChannel.webhooks  Z     $ 	%[[%%66tww??BFGQ"""1DKK8GG @G!   9A3A,A3%A.)A3.A3avatarr   c                 K   ddl m} |t        j                  |      }| j                  j
                  j                  | j                  t        |      ||       d{   } |j                  || j                        S 7 "waz  |coro|

        Creates a webhook for this channel.

        Requires :attr:`~.Permissions.manage_webhooks` permissions.

        .. versionchanged:: 1.1
            Added the ``reason`` keyword-only parameter.

        Parameters
        ----------
        name: :class:`str`
            The webhook's name.
        avatar: Optional[:class:`bytes`]
            A :term:`py:bytes-like object` representing the webhook's default avatar.
            This operates similarly to :meth:`~ClientUser.edit`.
        reason: Optional[:class:`str`]
            The reason for creating this webhook. Shows up in the audit logs.

        Returns
        -------
        :class:`Webhook`
            The created webhook.

        Raises
        ------
        HTTPException
            Creating the webhook failed.
        Forbidden
            You do not have permissions to create a webhook.
        r   r@   N)rC   r  r   r   
r   rA   r   _bytes_to_base64_datar|   r   create_webhookrD   rJ   r  rN   rC   r  r   rA   rf   s         rO   r  z_TextChannel.create_webhook  w     F 	%008F[[%%44GG#d)F6 5 
 
 "w!!$dkk::
   ABB #Bc                 K   | j                         st        d      t        |t              s"t	        d|j
                  j                         ddlm} | j                  j                  j                  | j                  |j                  |       d{   } |j                  ||| j                  j                        S 7 -w)aQ  
        Follows a channel using a webhook.

        Only news channels can be followed.

        .. note::

            The webhook returned will not provide a token to do webhook
            actions, as Discord does not provide it.

        .. versionadded:: 1.3

        Parameters
        ----------
        destination: :class:`TextChannel`
            The channel you would like to follow from.
        reason: Optional[:class:`str`]
            The reason for following the channel. Shows up on the destination guild's audit log.

            .. versionadded:: 1.4

        Returns
        -------
        :class:`Webhook`
            The created webhook.

        Raises
        ------
        HTTPException
            Following the channel failed.
        Forbidden
            You do not have the permissions to create a webhook.
        z#The channel must be a news channel.zExpected TextChannel received r   r@   )webhook_channel_idr   N)channeluser)is_newsr   rH   r&   r   rM   rq   r   rA   r|   r   follow_webhookrD   _as_followerr  )rN   destinationr   rA   rf   s        rO   followz_TextChannel.follow  s     J ||~!"GHH+{3!01F1F1O1O0PQ  	%[[%%44GGv 5 
 
 $w##D+DKKDTDTUU
s   BCC.Cc               "    ddl m}  || |      S a  Creates a :class:`PartialMessage` from the message ID.

        This is useful if you want to work with a message and only have its ID without
        doing an unnecessary API call.

        .. versionadded:: 1.6

        Parameters
        ----------
        message_id: :class:`int`
            The message ID to create a partial message for.

        Returns
        -------
        :class:`PartialMessage`
            The partial message.
        r   r7   r  rD   messager7   rN   r   r7   s      rO   get_partial_messagez _TextChannel.get_partial_messageL      & 	,dz::rQ   c               8    | j                   j                  |      S )a1  Returns a thread with the given ID.

        .. versionadded:: 2.0

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

        Returns
        -------
        Optional[:class:`Thread`]
            The returned thread or ``None`` if not found.
        )rz   
get_thread)rN   	thread_ids     rO   r$  z_TextChannel.get_threadc  s     zz$$Y//rQ   2   )privater   r   r   c               L    t        | j                  | j                  ||||      S )a  Returns an :class:`~discord.AsyncIterator` that iterates over all archived threads in the guild.

        You must have :attr:`~Permissions.read_message_history` to use this. If iterating over private threads
        then :attr:`~Permissions.manage_threads` is also required.

        .. versionadded:: 2.0

        Parameters
        ----------
        limit: Optional[:class:`bool`]
            The number of threads to retrieve.
            If ``None``, retrieves every archived thread in the channel. Note, however,
            that this would make it a slow operation.
        before: Optional[Union[:class:`abc.Snowflake`, :class:`datetime.datetime`]]
            Retrieve archived channels before the given date or ID.
        private: :class:`bool`
            Whether to retrieve private archived threads.
        joined: :class:`bool`
            Whether to retrieve private archived threads that you've joined.
            You cannot set ``joined`` to ``True`` and ``private`` to ``False``.

        Yields
        ------
        :class:`Thread`
            The archived threads.

        Raises
        ------
        Forbidden
            You do not have permissions to get archived threads.
        HTTPException
            The request to get the archived threads failed.
        )r   r   r'  r   )r   rD   rz   )rN   r'  r   r   r   s        rO   archived_threadsz_TextChannel.archived_threadst  s,    R &GGJJ
 	
rQ   )r_   r9   rz   r1   rf   (TextChannelPayload | ForumChannelPayloadrm   ztuple[str, ...]ro   )rz   r1   rf   r*  rm   rn   rm   r   rm   ra   r   zMember | Rolerm   r"   rm   zlist[Member])rm   zlist[Thread]rm   rl   rm   zMessage | None)rm   ry   )rC   
str | Noner   r2  rm   r&   r   zIterable[Snowflake]r   r2  rm   rn   r   
int | Noner   zCallable[[Message], bool]r   SnowflakeTime | Noner   r6  r   r6  r   bool | Noner   rl   r   r2  rm   zlist[Message]rm   zlist[Webhook]rC   rJ   r  zbytes | Noner   r2  rm   rA   )r  r&   r   r2  rm   rA   r   ra   rm   r7   )r%  ra   rm   zThread | None)
r'  rl   r   rl   r   r5  r   z$Snowflake | datetime.datetime | Nonerm   r   )!rq   rr   rs   ru   rP   propertyr   rV   r   r   r   r   copy_docr   r   r2   r   r   r   r   r   r   r   r   r%   r   r  r  r  r!  r$  r)  __classcell__rM   s   @rO   ry   ry      s   I*	" 	" 		"
 7	" ? ?7
(("J(	(6 1 1 & & U^^GKK,,<<= > X X 	
 	
 
 
0" U^^GKK,,223$(t
!
2<
	
 4
 FJ3T+3T8B3T	3Tp  +2'+&*'+$)!O
 O
 )	O

 %O
 $O
 %O
 "O
 O
 O
 
O
bH0 48d+;+;$0+;AK+;	+;\ AE2V)2V3=2V	2Vh;.0( 7;0
 0
 	0

 0
 50
 
 0
rQ   ry   c                  (    e Zd ZdZ	 	 	 	 	 	 d fdZed fd       Zd fdZddZddZ	edd       Z
eddddddddddddd		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
       Zedd       ZdddZdeddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ xZS )r&   aR  Represents a Discord text channel.

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the channel's hash.

        .. describe:: str(x)

            Returns the channel's name.

    Attributes
    ----------
    name: :class:`str`
        The channel name.
    guild: :class:`Guild`
        The guild the channel belongs to.
    id: :class:`int`
        The channel ID.
    category_id: Optional[:class:`int`]
        The category channel ID this channel belongs to, if applicable.
    topic: Optional[:class:`str`]
        The channel's topic. ``None`` if it doesn't exist.
    position: Optional[:class:`int`]
        The position in the channel list. This is a number that starts at 0. e.g. the
        top channel is position 0. Can be ``None`` if the channel was received in an interaction.
    last_message_id: Optional[:class:`int`]
        The last message ID of the message sent to this channel. It may
        *not* point to an existing or valid message.
    slowmode_delay: :class:`int`
        The number of seconds a member must wait between sending messages
        in this channel. A value of `0` denotes that it is disabled.
        Bots and users with :attr:`~Permissions.manage_channels` or
        :attr:`~Permissions.manage_messages` bypass slowmode.
    nsfw: :class:`bool`
        If the channel is marked as "not safe for work".

        .. note::

            To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
    default_auto_archive_duration: :class:`int`
        The default auto archive duration in minutes for threads created in this channel.

        .. versionadded:: 2.0
    flags: :class:`ChannelFlags`
        Extra features of the channel.

        .. versionadded:: 2.0
    default_thread_slowmode_delay: Optional[:class:`int`]
        The initial slowmode delay to set on newly created threads in this channel.

        .. versionadded:: 2.3
    c               *    t         |   |||       y Nr_   rz   rf   r   rP   rN   r_   rz   rf   rM   s       rO   rP   zTextChannel.__init__       	uE=rQ   c                    t         |   dz   S )N)news)r   r   )rN   rM   s    rO   r   zTextChannel._repr_attrs  s    w"Y..rQ   c                &    t         |   ||       y rX   )r   r   rN   rz   rf   rM   s      rO   r   zTextChannel._update  s    t$rQ   c                   K   | S wrX   rw   rU   s    rO   _get_channelzTextChannel._get_channel          c                P    | j                   t        j                  j                  k(  S )z6Checks if the channel is a news/announcements channel.)r   r   rG  r   rU   s    rO   r  zTextChannel.is_news  s    zz[--3333rQ   c                "    | j                         S )zEquivalent to :meth:`is_news`.)r  rU   s    rO   rG  zTextChannel.news  s     ||~rQ   .)r   rC   r{   r   r}   sync_permissionscategoryr   r   r   r   
overwritesc                  K   y wrX   rw   )rN   r   rC   r{   r   r}   rP  rQ  r   r   r   r   rR  s                rO   r   zTextChannel.edit  s       !   c                   K   y wrX   rw   rU   s    rO   r   zTextChannel.edit  s	     03rT  Nr   c                  K   | j                  ||       d{   }|(| j                  | j                  | j                  |      S y7 /w)a.  |coro|

        Edits the channel.

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

        .. versionchanged:: 1.3
            The ``overwrites`` keyword-only parameter was added.

        .. versionchanged:: 1.4
            The ``type`` keyword-only parameter was added.

        .. versionchanged:: 2.0
            Edits are no longer in-place, the newly edited channel is returned instead.

        Parameters
        ----------
        name: :class:`str`
            The new channel name.
        topic: :class:`str`
            The new channel's topic.
        position: :class:`int`
            The new channel's position.
        nsfw: :class:`bool`
            To mark the channel as NSFW or not.
        sync_permissions: :class:`bool`
            Whether to sync permissions with the channel's new or pre-existing
            category. Defaults to ``False``.
        category: Optional[:class:`CategoryChannel`]
            The new category for this channel. Can be ``None`` to remove the
            category.
        slowmode_delay: :class:`int`
            Specifies the slowmode rate limit for user in this channel, in seconds.
            A value of `0` disables slowmode. The maximum value possible is `21600`.
        type: :class:`ChannelType`
            Change the type of this text channel. Currently, only conversion between
            :attr:`ChannelType.text` and :attr:`ChannelType.news` is supported. This
            is only available to guilds that contain ``NEWS`` in :attr:`Guild.features`.
        reason: Optional[:class:`str`]
            The reason for editing this channel. Shows up on the audit log.
        overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
            The overwrites to apply to channel permissions. Useful for creating secret channels.
        default_auto_archive_duration: :class:`int`
            The new default auto archive duration in minutes for threads created in this channel.
            Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
        default_thread_slowmode_delay: :class:`int`
            The new default slowmode delay in seconds for threads created in this channel.

            .. versionadded:: 2.3

        Returns
        -------
        Optional[:class:`.TextChannel`]
            The newly edited text channel. If the edit was only positional
            then ``None`` is returned instead.

        Raises
        ------
        InvalidArgument
            If position is less than 0 or greater than the number of channels, or if
            the permission overwrite information is not in proper form.
        Forbidden
            You do not have permissions to edit the channel.
        HTTPException
            Editing the channel failed.
        r   NrB  _editrM   r|   rz   rN   r   r   rj   s       rO   r   zTextChannel.edit  sK     J 

76
::>>4::G>TT  ;   AA	0A)r  auto_archive_durationr   r   	invitabler   c          	       K   |t         j                  }|[| j                  j                  j	                  | j
                  ||xs | j                  |j                  |xs d||       d{   }nY| j                  j                  j                  | j
                  |j
                  ||xs | j                  |xs d|       d{   }t        | j                  | j                  |      S 7 7 (w)a  |coro|

        Creates a thread in this text channel.

        To create a public thread, you must have :attr:`~discord.Permissions.create_public_threads`.
        For a private thread, :attr:`~discord.Permissions.create_private_threads` is needed instead.

        .. versionadded:: 2.0

        Parameters
        ----------
        name: :class:`str`
            The name of the thread.
        message: Optional[:class:`abc.Snowflake`]
            A snowflake representing the message to create the thread with.
            If ``None`` is passed then a private thread is created.
            Defaults to ``None``.
        auto_archive_duration: :class:`int`
            The duration in minutes before a thread is automatically archived for inactivity.
            If not provided, the channel's default auto archive duration is used.
        type: Optional[:class:`ChannelType`]
            The type of thread to create. If a ``message`` is passed then this parameter
            is ignored, as a thread created with a message is always a public thread.
            By default, this creates a private thread if this is ``None``.
        slowmode_delay: Optional[:class:`int`]
            Specifies the slowmode rate limit for users in this thread, in seconds.
            A value of ``0`` disables slowmode. The maximum value possible is ``21600``.
        invitable: Optional[:class:`bool`]
            Whether non-moderators can add other non-moderators to this thread.
            Only available for private threads, where it defaults to True.
        reason: :class:`str`
            The reason for creating a new thread. Shows up on the audit log.

        Returns
        -------
        :class:`Thread`
            The created thread

        Raises
        ------
        Forbidden
            You do not have permissions to create a thread.
        HTTPException
            Starting the thread failed.
        Nr   )rC   r[  r   r   r\  r   )rC   r[  r   r   rz   r_   rf   )r   private_threadr|   r   start_thread_without_messagerD   r   r   start_thread_with_messager$   rz   )	rN   rC   r  r[  r   r   r\  r   rf   s	            rO   create_threadzTextChannel.create_thread^  s     r <--D?))FF&; '655ZZ$2$7a# G 	 	D ))CC

&; '655$2$7a D  D DJJdkkEE+	s%   A*C1,C--AC1C/'C1/C1)r_   r9   rz   r1   rf   TextChannelPayloadr+  )rz   r1   rf   rc  rm   rn   )rm   r&   r0  )r   r2  rC   rJ   r{   rJ   r   ra   r}   rl   rP  rl   rQ  CategoryChannel | Noner   ra   r   r<   r   ra   r   r   rR  7Mapping[Role | Member | Snowflake, PermissionOverwrite]rm   TextChannel | None)rm   rf  )rC   rJ   r  zSnowflake | Noner[  r<   r   ChannelType | Noner   r5  r\  r7  r   r2  rm   r$   )rq   rr   rs   rt   rP   r;  r   r   rK  r  rG  r
   r   r%   rb  r=  r>  s   @rO   r&   r&     s   =~>'>05>=O>
 / /%4    !!$+.!?B-0NQ! ! 	!
 ! ! ! ! )! ! (=! (+! ! L! 
! !" 3 3#' HU\ %)7>#'%)!%!RF RF "	RF
  5RF !RF #RF RF RF 
RFrQ   r&   c                  4    e Zd ZdZ	 	 	 	 	 	 d fdZd fdZedd       Zedd       Z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
       ZdddZ	 dddddddddddeedd	 	 	 	 	 	 	 	 	 ddZ xZS )r-   al
  Represents a Discord forum channel.

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the channel's hash.

        .. describe:: str(x)

            Returns the channel's name.

    Attributes
    ----------
    name: :class:`str`
        The channel name.
    guild: :class:`Guild`
        The guild the channel belongs to.
    id: :class:`int`
        The channel ID.
    category_id: Optional[:class:`int`]
        The category channel ID this channel belongs to, if applicable.
    topic: Optional[:class:`str`]
        The channel's topic. ``None`` if it doesn't exist.

        .. note::

            :attr:`guidelines` exists as an alternative to this attribute.
    position: Optional[:class:`int`]
        The position in the channel list. This is a number that starts at 0. e.g. the
        top channel is position 0. Can be ``None`` if the channel was received in an interaction.
    last_message_id: Optional[:class:`int`]
        The last message ID of the message sent to this channel. It may
        *not* point to an existing or valid message.
    slowmode_delay: :class:`int`
        The number of seconds a member must wait between sending messages
        in this channel. A value of `0` denotes that it is disabled.
        Bots and users with :attr:`~Permissions.manage_channels` or
        :attr:`~Permissions.manage_messages` bypass slowmode.
    nsfw: :class:`bool`
        If the channel is marked as "not safe for work".

        .. note::

            To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
    default_auto_archive_duration: :class:`int`
        The default auto archive duration in minutes for threads created in this channel.

        .. versionadded:: 2.0
    flags: :class:`ChannelFlags`
        Extra features of the channel.

        .. versionadded:: 2.0
    available_tags: List[:class:`ForumTag`]
        The set of tags that can be used in a forum channel.

        .. versionadded:: 2.3
    default_sort_order: Optional[:class:`SortOrder`]
        The default sort order type used to order posts in this channel.

        .. versionadded:: 2.3
    default_thread_slowmode_delay: Optional[:class:`int`]
        The initial slowmode delay to set on newly created threads in this channel.

        .. versionadded:: 2.3
    default_reaction_emoji: Optional[:class:`str` | :class:`discord.Emoji`]
        The default forum reaction emoji.

        .. versionadded:: 2.5
    c               *    t         |   |||       y rA  rC  rD  s       rO   rP   zForumChannel.__init__  rE  rQ   c                   t         |   ||       |j                  d      xs g D cg c]#  }t        j	                  | j
                  |      % c}| _        |j                  dd       | _        | j                  t        t        | j                        | _        |j                  d      }|S|j                  d      }||d   | _
        y | j
                  j                  t        j                  |d            | _
        y y c c}w )Nr   )r_   rf   r   r   r\   r^   )r   r   rb   r.   rg   r|   r   r   r   r   r   	get_emojir   rc   )rN   rz   rf   tagreaction_emoji_ctxr\   rM   s         rO   r   zForumChannel._update  s    t$ !128b/
 T[[s;/
 59HH=QSW4X"".&.y$:Q:Q&RD##'88,D#E)+//=J%.@.N+.2kk.C.C++,>
K/+ */
s   (Dc                    | j                   S )z4The channel's guidelines. An alias of :attr:`topic`.r{   rU   s    rO   
guidelineszForumChannel.guidelines  s     zzrQ   c                .    | j                   j                  S )zWhether a tag is required to be specified when creating a thread in this forum channel.

        Tags are specified in :attr:`applied_tags`.

        .. versionadded:: 2.3
        )r   require_tagrU   s    rO   requires_tagzForumChannel.requires_tag!  s     zz%%%rQ   c               D    t        j                  | j                  |      S )zReturns the :class:`ForumTag` from this forum channel with the
        given ID, if any.

        .. versionadded:: 2.3
        rD   )r   rb   r   )rN   rD   s     rO   get_tagzForumChannel.get_tag+  s     yy,,44rQ   .)r   rC   r{   r   r}   rP  rQ  r   r   r   r   r   r   rr  rR  c                  K   y wrX   rw   )rN   r   rC   r{   r   r}   rP  rQ  r   r   r   r   r   r   rr  rR  s                   rO   r   zForumChannel.edit3  s     & "rT  c                   K   y wrX   rw   rU   s    rO   r   zForumChannel.editH  	     14rT  Nr   c                  K   | j                  ||       d{   }|(| j                  | j                  | j                  |      S y7 /w)a   |coro|

        Edits the channel.

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

        Parameters
        ----------
        name: :class:`str`
            The new channel name.
        topic: :class:`str`
            The new channel's topic.
        position: :class:`int`
            The new channel's position.
        nsfw: :class:`bool`
            To mark the channel as NSFW or not.
        sync_permissions: :class:`bool`
            Whether to sync permissions with the channel's new or pre-existing
            category. Defaults to ``False``.
        category: Optional[:class:`CategoryChannel`]
            The new category for this channel. Can be ``None`` to remove the
            category.
        slowmode_delay: :class:`int`
            Specifies the slowmode rate limit for user in this channel, in seconds.
            A value of `0` disables slowmode. The maximum value possible is `21600`.
        reason: Optional[:class:`str`]
            The reason for editing this channel. Shows up on the audit log.
        overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
            The overwrites to apply to channel permissions. Useful for creating secret channels.
        default_auto_archive_duration: :class:`int`
            The new default auto archive duration in minutes for threads created in this channel.
            Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
        default_thread_slowmode_delay: :class:`int`
            The new default slowmode delay in seconds for threads created in this channel.

            .. versionadded:: 2.3
        default_sort_order: Optional[:class:`SortOrder`]
            The default sort order type to use to order posts in this channel.

            .. versionadded:: 2.3
        default_reaction_emoji: Optional[:class:`discord.Emoji` | :class:`int` | :class:`str`]
            The default reaction emoji.
            Can be a unicode emoji or a custom emoji in the forms:
            :class:`Emoji`, snowflake ID, string representation (eg. '<a:emoji_name:emoji_id>').

            .. versionadded:: 2.5
        available_tags: List[:class:`ForumTag`]
            The set of tags that can be used in this channel. Must be less than `20`.

            .. versionadded:: 2.3
        require_tag: :class:`bool`
            Whether a tag should be required to be specified when creating a thread in this channel.

            .. versionadded:: 2.3

        Returns
        -------
        Optional[:class:`.ForumChannel`]
            The newly edited forum channel. If the edit was only positional
            then ``None`` is returned instead.

        Raises
        ------
        InvalidArgument
            If position is less than 0 or greater than the number of channels, or if
            the permission overwrite information is not in proper form.
        Forbidden
            You do not have permissions to edit the channel.
        HTTPException
            Editing the channel failed.
        r   NrB  rW  rY  s       rO   r   zForumChannel.editK  sK     T 

76
::>>4::G>TT  ;rZ  )embedembedsfilefilesstickersdelete_message_afternonceallowed_mentionsviewapplied_tagsr[  r   r   c                 K   | j                   }|t        |      nd}||t        d      ||j                         }n8|6t	        |      dkD  rt        d      |D cg c]  }|j                          }}||D cg c]  }|j
                   }}|
)|j                  xr |j                  j                         }
nF|j                  *|j                  j                  |
      j                         }
n|
j                         }
|r5t        |d      st        d|j                        |j                         }nd}|"|D cg c]  }t        |j
                         }}||t        d      |6t	        |      dkD  rt        d      t        d	 |D              st        d
      |t        |t              st        d      |g}	 |j                  j                  | j
                  |||||	|
|||xs | j                   |xs | j"                  ||       d{   }||D ]  }|j%                           	 t'        | j(                  | j                   |      }|j+                  t-        |d               }|r|j/                  ||j
                         ||j1                  |       d{    |S c c}w c c}w c c}w 7 # ||D ]  }|j%                           w w xY w7 6w)a  |coro|

        Creates a thread in this forum channel.

        To create a public thread, you must have :attr:`~discord.Permissions.create_public_threads`.
        For a private thread, :attr:`~discord.Permissions.create_private_threads` is needed instead.

        .. versionadded:: 2.0

        Parameters
        ----------
        name: :class:`str`
            The name of the thread.
        content: :class:`str`
            The content of the message to send.
        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.
        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.
        stickers: Sequence[Union[:class:`~discord.GuildSticker`, :class:`~discord.StickerItem`]]
            A list of stickers to upload. Must be a maximum of 3.
        delete_message_after: :class:`int`
            The time to wait before deleting the thread.
        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.
        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.
        view: :class:`discord.ui.View`
            A Discord UI View to add to the message.
        applied_tags: List[:class:`discord.ForumTag`]
            A list of tags to apply to the new thread.
        auto_archive_duration: :class:`int`
            The duration in minutes before a thread is automatically archived for inactivity.
            If not provided, the channel's default auto archive duration is used.
        slowmode_delay: :class:`int`
            The number of seconds a member must wait between sending messages
            in the new thread. A value of `0` denotes that it is disabled.
            Bots and users with :attr:`~Permissions.manage_channels` or
            :attr:`~Permissions.manage_messages` bypass slowmode.
            If not provided, the forum channel's default slowmode is used.
        reason: :class:`str`
            The reason for creating a new thread. Shows up on the audit log.

        Returns
        -------
        :class:`Thread`
            The created thread

        Raises
        ------
        Forbidden
            You do not have permissions to create a thread.
        HTTPException
            Starting the thread failed.
        Nz>cannot pass both embed and embeds parameter to create_thread()
   z4embeds parameter must be a list of up to 10 elements__discord_ui_view__z view parameter must be View not z3cannot pass both file and files parameter to send()z3files parameter must be a list of up to 10 elementsc              3  <   K   | ]  }t        |t                y wrX   )rH   r   )r   r}  s     rO   r   z-ForumChannel.create_thread.<locals>.<genexpr>!  s     BDD$/Bs   z&files parameter must be a list of Filezfile parameter must be File)contentrC   r~  r{  r|  r  r  r  
componentsr[  r   r  r   r^  r   )delay)r|   rJ   r   rk   r   rD   r  mergehasattrrM   to_componentsallrH   r   r   start_forum_threadr   r   closer$   rz   r!  ra   
store_viewdelete)rN   rC   r  r{  r|  r}  r~  r  r  r  r  r  r  r[  r   r   r_   message_contentstickerr  rl  rf   fretmsgs                            rO   rb  zForumChannel.create_thread  s    h *1*=#g,4!3!P  MMOE6{R%J  4::%emmo:F:2:;w

;H;#&&K5+A+A+I+I+K  ##/$55;;<LMUUW/7794!67%6t~~6HI  ++-JJ#3?@CCK@L@ 1!"WXX5zB%I  BEBB%&NOOdD)%&CDDFE	66'!1!%&; '655$2$Id6I6I) 7  D$   AGGI 4::T[[tD%%c$/@*A&BCT366*+**#7*888
S ; <, A&$   AGGI ! 9sd   AK'J56K'>J:B2K'J?A)K'	AK KK  BK'.K%/K'K K""K')r_   r9   rz   r1   rf   ForumChannelPayload)rz   r1   rf   r  rm   rn   )rm   r2  r0  )rD   ra   rm   zForumTag | None) r   r2  rC   rJ   r{   rJ   r   ra   r}   rl   rP  rl   rQ  rd  r   ra   r   r<   r   ra   r   r   r   zEmoji | int | str | Noner   zlist[ForumTag]rr  rl   rR  re  rm   ForumChannel | None)rm   r  rX   )
rC   rJ   r[  r<   r   ra   r   r2  rm   r$   )rq   rr   rs   rt   rP   r   r;  rp  rs  rv  r
   r   r%   rb  r=  r>  s   @rO   r-   r-     s   M^>'>05>=P>
(   & &5  !!$+.!?B-0(+;>),NQ#" " 	"
 " " " " )" " (=" (+" &" !9" '"  !"" L#"$ 
%" "( 4 4#' MUd m
 !7>%!#mm  5m  !m" #m$ 
%mrQ   r-   c                       e Zd ZdZ	 	 	 	 	 	 d
dZddZddZ	 	 	 	 	 	 ddZedd       Z	edd       Z
edd       Z ej                  ej                  j                   j"                        d fd	       Z xZS )VocalGuildChannel)rC   rD   rz   bitrate
user_limitr|   r   r   r   r~   
rtc_regionvideo_quality_moder   r   r}   c               \    || _         t        |d         | _        | j                  ||       y r   r   r   s       rO   rP   zVocalGuildChannel.__init__]  r   rQ   c                2    | j                   j                  dfS )Nguild_idrz   rD   rU   s    rO   _get_voice_client_keyz'VocalGuildChannel._get_voice_client_keyh  s    zz}}j((rQ   c                F    | j                   j                  | j                  fS rX   r  rU   s    rO   _get_voice_state_pairz'VocalGuildChannel._get_voice_state_pairk  s    zz}}dgg%%rQ   c                   || _         |d   | _        t        j                  |d      | _        |j                  dd      s|j                  d      }|t        t        |      nd | _	        t        t        |j                  dd            | _        t        j                  |d      | _        |j                  d	      | _        |j                  d
d      | _        |j                  d      | _        |j                  d      | _        t#        j$                  |j                  dd            | _        |j                  dd      | _        | j+                  |       y y )NrC   r   r   Fr  r  r   r   r   r   r   r  r  r   r}   )rz   rC   r   rc   r~   r   rb   r   r   r  r   r  r   r   r   r  r  r   r   r   r}   r   )rN   rz   rf   rtcs       rO   r   zVocalGuildChannel._updaten  s%    
f	','>'>t['Q xx.((<(C.1oc*4 O 9A $((+?"C9D# 05/F/F'0D  "&*!5DM"&((+@!"DD $ 3DL#'88L#9DO'3'?'?RS@T'UDJ"hhvu5DI!!$'# /rQ   c                6    t         j                  j                  S rX   )r   r   r   rU   s    rO   r   z!VocalGuildChannel._sorting_bucket  s      &&&rQ   c                "   g }| j                   j                  j                         D ]e  \  }}|j                  s|j                  j                  | j                  k(  s7| j                   j                  |      }|U|j                  |       g |S )zAReturns all members that are currently inside this voice channel.)rz   _voice_statesitemsr  rD   
get_memberappend)rN   r  user_idr_   members        rO   r   zVocalGuildChannel.members  sx     "jj66<<> 	'NGU}}!1!1TWW!<..w7%JJv&		'
 
rQ   c                    | j                   j                  j                         D ci c]7  \  }}|j                  r&|j                  j                  | j                  k(  r||9 c}}S c c}}w )a  Returns a mapping of member IDs who have voice states in this channel.

        .. versionadded:: 1.3

        .. note::

            This function is intentionally low level to replace :attr:`members`
            when the member cache is unavailable.

        Returns
        -------
        Mapping[:class:`int`, :class:`VoiceState`]
            The mapping of member ID to a voice state.
        )rz   r  r  r  rD   )rN   keyr   s      rO   voice_stateszVocalGuildChannel.voice_states  s[    $ #jj66<<>
U}}!1!1TWW!< J
 	
 
s   <A(c                   t         |   |      }|j                  sGt        j                         }|j                  dd       |xj                  |j                   z  c_        |S )NT)manage_channelsmanage_roles)r   r   connectr"   r   updater   r   s       rO   r   z!VocalGuildChannel.permissions_for  sR    w&s+ || &&(FMM$TMBJJ6<<-'JrQ   )r_   r9   rz   r1   rf   )VoiceChannelPayload | StageChannelPayload)rm   ztuple[int, str])rm   ztuple[int, int])rz   r1   rf   r  rm   rn   r-  r/  )rm   zdict[int, VoiceState]r.  )rq   rr   rs   ru   rP   r  r  r   r;  r   r   r  r   r<  r   r   r2   r   r=  r>  s   @rO   r  r  J  s    I$	" 	" 		"
 8	")&(("K(	(8 ' '   
 
* U^^GKK,,<<=	 >	rQ   r  c                      e Zd ZdZ	 	 	 	 	 	 d fdZd fdZd dZd Zd!dZe	d"d       Z
d#dZd	d
	 	 	 	 	 d$dZded	d	d	ddd	d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d%dZd&dZd	d	d	 	 	 	 	 	 	 d'dZe	d(d       Z ej&                  ej*                  j,                  j.                        d	d	d	 	 	 	 	 d)d       Zedddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d*d       Zed+d       Zd	d
dZ	 	 	 	 d,dZd	d
	 	 	 	 	 d-dZ xZS ).r'   a  Represents a Discord guild voice channel.

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the channel's hash.

        .. describe:: str(x)

            Returns the channel's name.

    Attributes
    ----------
    name: :class:`str`
        The channel name.
    guild: :class:`Guild`
        The guild the channel belongs to.
    id: :class:`int`
        The channel ID.
    category_id: Optional[:class:`int`]
        The category channel ID this channel belongs to, if applicable.
    position: Optional[:class:`int`]
        The position in the channel list. This is a number that starts at 0. e.g. the
        top channel is position 0. Can be ``None`` if the channel was received in an interaction.
    bitrate: :class:`int`
        The channel's preferred audio bitrate in bits per second.
    user_limit: :class:`int`
        The channel's limit for number of members that can be in a voice channel.
    rtc_region: Optional[:class:`VoiceRegion`]
        The region for the voice channel's voice communication.
        A value of ``None`` indicates automatic voice region detection.

        .. versionadded:: 1.7
    video_quality_mode: :class:`VideoQualityMode`
        The camera video quality for the voice channel's participants.

        .. versionadded:: 2.0
    last_message_id: Optional[:class:`int`]
        The ID of the last message sent to this channel. It may not always point to an existing or valid message.

        .. versionadded:: 2.0
    slowmode_delay: :class:`int`
        The number of seconds a member must wait between sending messages
        in this channel. A value of `0` denotes that it is disabled.
        Bots and users with :attr:`~Permissions.manage_channels` or
        :attr:`~Permissions.manage_messages` bypass slowmode.

        .. versionadded:: 2.5
    status: Optional[:class:`str`]
        The channel's status, if set.

        .. versionadded:: 2.5
    flags: :class:`ChannelFlags`
        Extra features of the channel.

        .. versionadded:: 2.0
    c               8    d | _         t        | 	  |||       y rA  )statusr   rP   rD  s       rO   rP   zVoiceChannel.__init__   s      #'uE=rQ   c                v    t         |   ||       |j                  d      r|j                  d      | _        y y )Nr  )r   r   rb   r  rI  s      rO   r   zVoiceChannel._update
  s2    t$88H((8,DK rQ   c           
     Z   d| j                   fd| j                  fd| j                  fd| j                  fd| j                  fd| j
                  fd| j                  fd| j                  fd	| j                  fg	}d
j                  d |D              }d| j                  j                   d
| dS )NrD   rC   r  r  r   r  r  r  r~   r   c              3  &   K   | ]	  }d |z    ywr   rw   r   s     rO   r   z(VoiceChannel.__repr__.<locals>.<genexpr>  r   r   r   rT   )rD   rC   r  r  r   r  r  r  r~   r   rM   rq   rN   r   r   s      rO   rV   zVoiceChannel.__repr__  s    477OTYYt{{#4??+'%!4#:#:;4??+D,,-

 5u554>>**+1VHA66rQ   c                   K   | S wrX   rw   rU   s    rO   rK  zVoiceChannel._get_channel  rL  rM  c                    | j                   S r   r   rU   s    rO   r   zVoiceChannel.is_nsfw!  r   rQ   c                h    | j                   r%| j                  j                  | j                         S dS r   r   rU   s    rO   r   zVoiceChannel.last_message%  r   rQ   c               "    ddl m}  || |      S r  r  r   s      rO   r!  z VoiceChannel.get_partial_message>  r"  rQ   Nr   c                 K   t        |t        t        f      st        |      }t        |      dk(  ryt        |      dk(  rJ|d   j                  }| j
                  j                  j                  | j                  ||       d{    yt        |      dkD  rt        d      |D cg c]  }|j                   }}| j
                  j                  j                  | j                  ||       d{    y7 rc c}w 7 wr   r   r   s         rO   r   zVoiceChannel.delete_messagesU  r   r   r   FTr   c               n   K   t         j                  j                  | ||||||||	       d{   S 7 wr   r   r   s	            rO   r   zVoiceChannel.purge  r   r   c                   K   ddl m} | j                  j                  j	                  | j
                         d{   }|D cg c]   } |j                  || j                        " c}S 7 0c c}w wr   r   r  s       rO   r  zVoiceChannel.webhooks  r  r  r  c                 K   ddl m} |t        j                  |      }| j                  j
                  j                  | j                  t        |      ||       d{   } |j                  || j                        S 7 "wr
  r  r  s         rO   r  zVoiceChannel.create_webhook  r  r  c                "    t         j                  S r   )r   r   rU   s    rO   r   zVoiceChannel.type          rQ   r   c               t   K   | j                  | j                  | j                  d||       d {   S 7 w)N)r  r  r   )r   r  r  r   s      rO   r   zVoiceChannel.clone$  s@      %%DOOD & 
 
 	
 
s   /868.)rC   r  r  r   rP  rQ  rR  r  r  r   r   c                  K   y wrX   rw   )rN   rC   r  r  r   rP  rQ  rR  r  r  r   r   s               rO   r   zVoiceChannel.edit.  s      "rT  c                   K   y wrX   rw   rU   s    rO   r   zVoiceChannel.edit?  ry  rT  c                  K   | j                  ||       d{   }|(| j                  | j                  | j                  |      S y7 /w)a  |coro|

        Edits the channel.

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

        .. versionchanged:: 1.3
            The ``overwrites`` keyword-only parameter was added.

        .. versionchanged:: 2.0
            Edits are no longer in-place, the newly edited channel is returned instead.

        Parameters
        ----------
        name: :class:`str`
            The new channel's name.
        bitrate: :class:`int`
            The new channel's bitrate.
        user_limit: :class:`int`
            The new channel's user limit.
        position: :class:`int`
            The new channel's position.
        sync_permissions: :class:`bool`
            Whether to sync permissions with the channel's new or pre-existing
            category. Defaults to ``False``.
        category: Optional[:class:`CategoryChannel`]
            The new category for this channel. Can be ``None`` to remove the
            category.
        reason: Optional[:class:`str`]
            The reason for editing this channel. Shows up on the audit log.
        overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
            The overwrites to apply to channel permissions. Useful for creating secret channels.
        rtc_region: Optional[:class:`VoiceRegion`]
            The new region for the voice channel's voice communication.
            A value of ``None`` indicates automatic voice region detection.

            .. versionadded:: 1.7
        video_quality_mode: :class:`VideoQualityMode`
            The camera video quality for the voice channel's participants.

            .. versionadded:: 2.0

        Returns
        -------
        Optional[:class:`.VoiceChannel`]
            The newly edited voice channel. If the edit was only positional
            then ``None`` is returned instead.

        Raises
        ------
        InvalidArgument
            If the permission overwrite information is not in proper form.
        Forbidden
            You do not have permissions to edit the channel.
        HTTPException
            Editing the channel failed.
        r   NrB  rW  rY  s       rO   r   zVoiceChannel.editB  sK     x 

76
::>>4::G>TT  ;rZ  c                   K   t        |t              r|j                  }nt        |t              st	        d       | j
                  dt        j                  |d| d{   S 7 w)a  |coro|

        A shortcut method that creates an instant activity invite.

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

        Parameters
        ----------
        activity: Union[:class:`discord.EmbeddedActivity`, :class:`int`]
            The activity to create an invite for which can be an application id as well.
        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.

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

        Raises
        ------
        TypeError
            If the activity is not a valid activity or application id.
        ~discord.HTTPException
            Invite creation failed.
        z'Invalid type provided for the activity.)target_typetarget_application_idNrw   )rH   r   r   ra   rL   create_inviter   embedded_application)rN   activitykwargss      rO   create_activity_invitez#VoiceChannel.create_activity_invite  sm     V h 01~~HHc*EFF'T'' 
$99"*
 
 
 	
 
s   AA(!A&"A(c                  K   | j                   j                  j                  | j                  ||       d{    y7 w)a-  |coro|

        Sets the status of the voice channel.

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

        Parameters
        ----------
        status: Union[:class:`str`, None]
            The new status.
        reason: Optional[:class:`str`]
            The reason for setting the status. Shows up on the audit log.

        Raises
        ------
        Forbidden
            You do not have proper permissions to set the status.
        HTTPException
            Setting the status failed.
        r   N)r|   r   set_voice_channel_statusrD   )rN   r  r   s      rO   
set_statuszVoiceChannel.set_status  s2     . kk77PV7WWWs   6A >A )r_   r9   rz   r1   rf   VoiceChannelPayload)rz   r1   rf   r  ro   r0  r1  r:  r3  r4  r8  r9  r,  )rC   r2  r   r2  rm   r'   )rC   rJ   r  ra   r  ra   r   ra   rP  ra   rQ  rd  rR  +Mapping[Role | Member, PermissionOverwrite]r  VoiceRegion | Noner  r   r   ra   r   r2  rm   VoiceChannel | None)rm   r  )r  zEmbeddedActivity | intrm   r   )r  r2  r   r2  rm   rn   )rq   rr   rs   rt   rP   r   rV   rK  r   r;  r   r!  r   r%   r   r  r  r   r   r<  r   r   r2   r   r
   r   r  r  r=  r>  s   @rO   r'   r'     s   AF> > 	>
 ">-
7 
 
0;0 FJ3T+3T8B3T	3Tp  +2'+&*'+$)!O
 O
 )	O

 %O
 $O
 %O
 "O
 O
 O
 
O
bH0 48d+;+;$0+;AK+;	+;Z ! ! U^^GKK,,223$(t
!
2<
	
 4
   #+.BE),/2! " " 	"
 " " " )" @" '" -" " " 
" "  4 4#' ?UB5
.5
	5
p ;?X X-7X	XrQ   r'   c                  X    e Zd ZdZdZd$ fdZd%dZed&d       Zed&d       Z	ed&d       Z
d Zd'd	Zed(d
       Zd)dZdd	 	 	 	 	 d*dZdeddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+dZd,dZddd	 	 	 	 	 	 	 d-dZed&d       Zed.d       Z ej.                  ej2                  j4                  j6                        ddd	 	 	 	 	 d/d       Zed0d       Zeddd	 	 	 	 	 	 	 	 	 d1dZd2dZedddddddddd 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d3d!       Z ed4d"       Z ddd#Z  xZ!S )5r(   a9  Represents a Discord guild stage channel.

    .. versionadded:: 1.7

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the channel's hash.

        .. describe:: str(x)

            Returns the channel's name.

    Attributes
    ----------
    name: :class:`str`
        The channel name.
    guild: :class:`Guild`
        The guild the channel belongs to.
    id: :class:`int`
        The channel ID.
    topic: Optional[:class:`str`]
        The channel's topic. ``None`` if it isn't set.
    category_id: Optional[:class:`int`]
        The category channel ID this channel belongs to, if applicable.
    position: Optional[:class:`int`]
        The position in the channel list. This is a number that starts at 0. e.g. the
        top channel is position 0. Can be ``None`` if the channel was received in an interaction.
    bitrate: :class:`int`
        The channel's preferred audio bitrate in bits per second.
    user_limit: :class:`int`
        The channel's limit for number of members that can be in a stage channel.
    rtc_region: Optional[:class:`VoiceRegion`]
        The region for the stage channel's voice communication.
        A value of ``None`` indicates automatic voice region detection.
    video_quality_mode: :class:`VideoQualityMode`
        The camera video quality for the stage channel's participants.

        .. versionadded:: 2.0
    flags: :class:`ChannelFlags`
        Extra features of the channel.

        .. versionadded:: 2.0
    last_message_id: Optional[:class:`int`]
        The ID of the last message sent to this channel. It may not always point to an existing or valid message.
        .. versionadded:: 2.5
    ro  c                R    t         |   ||       |j                  d      | _        y )Nr{   )r   r   rb   r{   rI  s      rO   r   zStageChannel._update  s!    t$XXg&
rQ   c           
     Z   d| j                   fd| j                  fd| j                  fd| j                  fd| j                  fd| j
                  fd| j                  fd| j                  fd	| j                  fg	}d
j                  d |D              }d| j                  j                   d
| dS )NrD   rC   r{   r  r   r  r  r  r~   r   c              3  &   K   | ]	  }d |z    ywr   rw   r   s     rO   r   z(StageChannel.__repr__.<locals>.<genexpr>   r   r   r   rT   )rD   rC   r{   r  r   r  r  r  r~   r   rM   rq   r  s      rO   rV   zStageChannel.__repr__  s    477OTYYdjj!4??+'%!4#:#:;4??+D,,-

 5u554>>**+1VHA66rQ   c                    | j                   D cg c]&  }|j                  r|j                  j                  |( c}S c c}w )zCA list of members who are requesting to speak in the stage channel.)r   r   requested_to_speak_atrN   r  s     rO   requesting_to_speakz StageChannel.requesting_to_speak#  s>    
 ,,
|| B B N 
 	
 
s   +=c                    | j                   D cg c]<  }|j                  r.|j                  j                  s|j                  j                  |> c}S c c}w )zpA list of members who have been permitted to speak in the stage channel.

        .. versionadded:: 2.0
        )r   r   suppressr  r  s     rO   speakerszStageChannel.speakers,  sL     ,,
||LL))22:	 
 	
 
s   AAc                    | j                   D cg c](  }|j                  s|j                  j                  s'|* c}S c c}w )zaA list of members who are listening in the stage channel.

        .. versionadded:: 2.0
        )r   r   r  r  s     rO   	listenerszStageChannel.listeners:  s7     "&
&,,BWBWF
 	
 
s   ???c                   K   | S wrX   rw   rU   s    rO   rK  zStageChannel._get_channelD  rL  rM  c                    | j                   S r   r   rU   s    rO   r   zStageChannel.is_nsfwG  r   rQ   c                h    | j                   r%| j                  j                  | j                         S dS r   r   rU   s    rO   r   zStageChannel.last_messageK  r   rQ   c               "    ddl m}  || |      S r  r  r   s      rO   r!  z StageChannel.get_partial_messaged  r"  rQ   Nr   c                 K   t        |t        t        f      st        |      }t        |      dk(  ryt        |      dk(  rJ|d   j                  }| j
                  j                  j                  | j                  ||       d{    yt        |      dkD  rt        d      |D cg c]  }|j                   }}| j
                  j                  j                  | j                  ||       d{    y7 rc c}w 7 wr   r   r   s         rO   r   zStageChannel.delete_messages{  r   r   r   FTr   c               n   K   t         j                  j                  | ||||||||	       d{   S 7 wr   r   r   s	            rO   r   zStageChannel.purge  r   r   c                   K   ddl m} | j                  j                  j	                  | j
                         d{   }|D cg c]   } |j                  || j                        " c}S 7 0c c}w wr   r   r  s       rO   r  zStageChannel.webhooks	  r  r  r  c                 K   ddl m} |t        j                  |      }| j                  j
                  j                  | j                  t        |      ||       d{   } |j                  || j                        S 7 "wr
  r  r  s         rO   r  zStageChannel.create_webhook	  r  r  c                    t        j                         }| j                  D cg c]  }| j                  |      |k\  r| c}S c c}w )z_A list of members who are moderating the stage channel.

        .. versionadded:: 2.0
        )r"   stage_moderatorr   r   )rN   required_permissionsr  s      rO   
moderatorszStageChannel.moderatorsE	  sM      +::< ,,
##F+/CC 
 	
 
s   Ac                "    t         j                  S r   )r   stage_voicerU   s    rO   r   zStageChannel.typeR	  s     &&&rQ   r   c               F   K   | j                  i ||       d {   S 7 w)Nr   )r   r   s      rO   r   zStageChannel.cloneW	  s&      %%btF%CCCCs   !!c                l    t        j                  | j                  j                  | j                        S )zXThe running stage instance of the stage channel.

        .. versionadded:: 2.0
        )
channel_id)r   rb   rz   stage_instancesrD   rU   s    rO   instancezStageChannel.instance]	  s#     yy33HHrQ   )privacy_levelr   send_notificationc               :  K   | j                   ||d}|t        ur*t        |t              st	        d      |j
                  |d<    | j                  j                  j                  di |d|i d{   }t        | j                  | j                  |      S 7 &w)a}  |coro|

        Create a stage instance.

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

        .. versionadded:: 2.0

        Parameters
        ----------
        topic: :class:`str`
            The stage instance's topic.
        privacy_level: :class:`StagePrivacyLevel`
            The stage instance's privacy level. Defaults to :attr:`StagePrivacyLevel.guild_only`.
        reason: :class:`str`
            The reason the stage instance was created. Shows up on the audit log.
        send_notification: :class:`bool`
            Send a notification to everyone in the server that the stage instance has started.
            Defaults to ``False``. Requires the ``mention_everyone`` permission.

        Returns
        -------
        :class:`StageInstance`
            The newly created stage instance.

        Raises
        ------
        InvalidArgument
            If the ``privacy_level`` parameter is not the proper type.
        Forbidden
            You do not have permissions to create a stage instance.
        HTTPException
            Creating a stage instance failed.
        )r  r{   send_start_notificationz0privacy_level field must be of type PrivacyLevelr  r   Nr^  rw   )rD   r%   rH   r   r   r   r|   r   create_stage_instancer#   rz   )rN   r{   r  r   r   rj   rf   s          rO   create_instancezStageChannel.create_instancee	  s     Z '''8#
 'm->?%F  (5':':GO$;T[[%%;;UgUfUU4::T[[tLL Vs   A0B2B3'Bc                   K   | j                   j                  j                  | j                         d{   }t	        | j
                  | j                   |      S 7 &w)as  |coro|

        Gets the running :class:`StageInstance`.

        .. versionadded:: 2.0

        Returns
        -------
        :class:`StageInstance`
            The stage instance.

        Raises
        ------
        NotFound
            The stage instance or channel could not be found.
        HTTPException
            Getting the stage instance failed.
        Nr^  )r|   r   get_stage_instancerD   r#   rz   )rN   rf   s     rO   fetch_instancezStageChannel.fetch_instance	  sF     & [[%%88AA4::T[[tLL Bs   3AA'A.)	rC   r{   r   rP  rQ  rR  r  r  r   c       	           K   y wrX   rw   )
rN   rC   r{   r   rP  rQ  rR  r  r  r   s
             rO   r   zStageChannel.edit	  s      "rT  c                   K   y wrX   rw   rU   s    rO   r   zStageChannel.edit	  ry  rT  c                  K   | j                  ||       d{   }|(| j                  | j                  | j                  |      S y7 /w)a  |coro|

        Edits the channel.

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

        .. versionchanged:: 2.0
            The ``topic`` parameter must now be set via :attr:`create_instance`.

        .. versionchanged:: 2.0
            Edits are no longer in-place, the newly edited channel is returned instead.

        Parameters
        ----------
        name: :class:`str`
            The new channel's name.
        position: :class:`int`
            The new channel's position.
        sync_permissions: :class:`bool`
            Whether to sync permissions with the channel's new or pre-existing
            category. Defaults to ``False``.
        category: Optional[:class:`CategoryChannel`]
            The new category for this channel. Can be ``None`` to remove the
            category.
        reason: Optional[:class:`str`]
            The reason for editing this channel. Shows up on the audit log.
        overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
            The overwrites to apply to channel permissions. Useful for creating secret channels.
        rtc_region: Optional[:class:`VoiceRegion`]
            The new region for the stage channel's voice communication.
            A value of ``None`` indicates automatic voice region detection.
        video_quality_mode: :class:`VideoQualityMode`
            The camera video quality for the stage channel's participants.

            .. versionadded:: 2.0

        Returns
        -------
        Optional[:class:`.StageChannel`]
            The newly edited stage channel. If the edit was only positional
            then ``None`` is returned instead.

        Raises
        ------
        InvalidArgument
            If the permission overwrite information is not in proper form.
        Forbidden
            You do not have permissions to edit the channel.
        HTTPException
            Editing the channel failed.
        r   NrB  rW  rY  s       rO   r   zStageChannel.edit	  sK     l 

76
::>>4::G>TT  ;rZ  )rz   r1   rf   StageChannelPayloadrm   rn   ro   r/  r0  r1  r:  r3  r4  r8  r9  r,  )rC   r2  r   r2  rm   r(   )rm   zStageInstance | None)
r{   rJ   r  r   r   r2  r   r7  rm   r#   )rm   r#   )rC   rJ   r{   r2  r   ra   rP  ra   rQ  rd  rR  r  r  r  r  r   r   r2  rm   StageChannel | None)rm   r  )"rq   rr   rs   rt   ru   r   rV   r;  r  r  r  rK  r   r   r!  r   r%   r   r  r  r  r   r   r<  r   r   r2   r   r  r  r  r
   r   r=  r>  s   @rO   r(   r(     s   7r I'7 
 
 
 
 
 
 
 
0;0 FJ3T+3T8B3T	3Tp  +2'+&*'+$)!O
 O
 )	O

 %O
 $O
 %O
 "O
 O
 O
 
O
bH0 48d+;+;$0+;AK+;	+;Z 

 

 ' ' U^^GKK,,223$(tD!D2<D	D 4D
 I I ,3!).;M ;M )	;M
 ;M ';M 
;MzM,   #+.BE),/2 " " 	"
 " " )" @" '" -" " 
" " 4 4#' 9U 9UrQ   r(   c                  *    e Zd ZdZdZ	 	 	 	 	 	 ddZddZddZedd       Z	ed d       Z
d!dZ ej                  ej                  j                   j"                        d	d	d
	 	 	 	 	 d"d       Zedddddd	 	 	 	 	 	 	 	 	 	 	 d#d       Zed$d       Zd	ddZ ej                  ej                  j                   j(                         f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+dZd,dZd-dZ xZS ).r*   a  Represents a Discord channel category.

    These are useful to group channels to logical compartments.

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the category's hash.

        .. describe:: str(x)

            Returns the category's name.

    Attributes
    ----------
    name: :class:`str`
        The category name.
    guild: :class:`Guild`
        The guild the category belongs to.
    id: :class:`int`
        The category channel ID.
    position: Optional[:class:`int`]
        The position in the category list. This is a number that starts at 0. e.g. the
        top category is position 0. Can be ``None`` if the channel was received in an interaction.
    nsfw: :class:`bool`
        If the channel is marked as "not safe for work".

        .. note::

            To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
    flags: :class:`ChannelFlags`
        Extra features of the channel.

        .. versionadded:: 2.0
    )	rC   rD   rz   r}   r|   r   r   r~   r   c               \    || _         t        |d         | _        | j                  ||       y r   r   r   s       rO   rP   zCategoryChannel.__init__@
  s(     (-4:UD!rQ   c           	     p    d| j                    d| j                  d| j                   d| j                   d	S )Nz<CategoryChannel id=rS   z
 position=z nsfw=rT   )rD   rC   r   r}   rU   s    rO   rV   zCategoryChannel.__repr__G
  s<    77)6$))jvdii[XY[	
rQ   c                R   || _         |d   | _        t        j                  |d      | _        |j                  dd      si|j                  dd      | _        |j                  d      | _        t        j                  |j                  dd            | _        | j                  |       y y )	NrC   r   r   Fr}   r   r   r   )rz   rC   r   rc   r~   r   rb   r}   r   r   r   r   r   r   s      rO   r   zCategoryChannel._updateM
  s    !
f	','>'>t['Q xx."hhvu5DI!%*!5DM'3'?'?RS@T'UDJ!!$'	 /rQ   c                6    t         j                  j                  S rX   )r   rQ  r   rU   s    rO   r   zCategoryChannel._sorting_bucketZ
  s    ##)))rQ   c                "    t         j                  S r   )r   rQ  rU   s    rO   r   zCategoryChannel.type^
  s     ###rQ   c                    | j                   S )zChecks if the category is NSFW.r   rU   s    rO   r   zCategoryChannel.is_nsfwc
  r   rQ   Nr   c               ^   K   | j                  d| j                  i||       d {   S 7 w)Nr}   r   )r   r}   r   s      rO   r   zCategoryChannel.cloneg
  s/      %%vtyy&9V%TTTTs   $-+-.)rC   r   r}   rR  r   c                  K   y wrX   rw   )rN   rC   r   r}   rR  r   s         rO   r   zCategoryChannel.editm
  s      "%rT  c                   K   y wrX   rw   rU   s    rO   r   zCategoryChannel.editx
  s	     47rT  r   c                  K   | j                  ||       d{   }|(| j                  | j                  | j                  |      S y7 /w)a  |coro|

        Edits the channel.

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

        .. versionchanged:: 1.3
            The ``overwrites`` keyword-only parameter was added.

        .. versionchanged:: 2.0
            Edits are no longer in-place, the newly edited channel is returned instead.

        Parameters
        ----------
        name: :class:`str`
            The new category's name.
        position: :class:`int`
            The new category's position.
        nsfw: :class:`bool`
            To mark the category as NSFW or not.
        reason: Optional[:class:`str`]
            The reason for editing this category. Shows up on the audit log.
        overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
            The overwrites to apply to channel permissions. Useful for creating secret channels.

        Returns
        -------
        Optional[:class:`.CategoryChannel`]
            The newly edited category channel. If the edit was only positional
            then ``None`` is returned instead.

        Raises
        ------
        InvalidArgument
            If position is less than 0 or greater than the number of categories.
        Forbidden
            You do not have permissions to edit the category.
        HTTPException
            Editing the category failed.
        r   NrB  rW  rY  s       rO   r   zCategoryChannel.edit{
  sK     V 

76
::>>4::G>TT  ;rZ  c                d   K   |j                  dd        t        |   di | d {    y 7 w)NrQ  rw   )r   r   move)rN   r  rM   s     rO   r  zCategoryChannel.move
  s*     

:t$gl$V$$$s   %0.0c                    d }| j                   j                  D cg c]  }|j                  | j                  k(  s|  }}|j	                  |       |S c c}w )zReturns the channels that are under this category.

        These are sorted by the official Discord UI, which places voice channels below the text channels.
        c                D    t        | t               | j                  xs dfS N)rH   ry   r   )r  s    rO   
comparatorz,CategoryChannel.channels.<locals>.comparator
  s"    !'<887;K;K;QrRRrQ   r  )rz   channelsr~   rD   sort)rN   r  cr  s       rO   r   zCategoryChannel.channels
  sO    	S **--JQ$''1IqJJZ 
 Ks
   AAc                    | j                   j                  D cg c]-  }|j                  | j                  k(  rt	        |t
              r|/ }}|j                  d        |S c c}w )z7Returns the text channels that are under this category.c                :    | j                   xs d| j                  fS r  r   rD   r"  s    rO   <lambda>z/CategoryChannel.text_channels.<locals>.<lambda>
      

 0b!$$7 rQ   r  )rz   r   r~   rD   rH   r&   r!  rN   r"  r  s      rO   text_channelszCategoryChannel.text_channels
  s_    
 ZZ((
}}'Jq+,F 
 

 	78

   2A"c                    | j                   j                  D cg c]-  }|j                  | j                  k(  rt	        |t
              r|/ }}|j                  d        |S c c}w )z8Returns the voice channels that are under this category.c                :    | j                   xs d| j                  fS r  r%  r&  s    rO   r'  z0CategoryChannel.voice_channels.<locals>.<lambda>
  r(  rQ   r  )rz   r   r~   rD   rH   r'   r!  r)  s      rO   voice_channelszCategoryChannel.voice_channels
  s_    
 ZZ((
}}'Jq,,G 
 

 	78

r+  c                    | j                   j                  D cg c]-  }|j                  | j                  k(  rt	        |t
              r|/ }}|j                  d        |S c c}w )z`Returns the stage channels that are under this category.

        .. versionadded:: 1.7
        c                :    | j                   xs d| j                  fS r  r%  r&  s    rO   r'  z0CategoryChannel.stage_channels.<locals>.<lambda>
  r(  rQ   r  )rz   r   r~   rD   rH   r(   r!  r)  s      rO   stage_channelszCategoryChannel.stage_channels
  _     ZZ((
}}'Jq,,G 
 

 	78

r+  c                    | j                   j                  D cg c]-  }|j                  | j                  k(  rt	        |t
              r|/ }}|j                  d        |S c c}w )z`Returns the forum channels that are under this category.

        .. versionadded:: 2.0
        c                :    | j                   xs d| j                  fS r  r%  r&  s    rO   r'  z0CategoryChannel.forum_channels.<locals>.<lambda>
  r(  rQ   r  )rz   r   r~   rD   rH   r-   r!  r)  s      rO   forum_channelszCategoryChannel.forum_channels
  r2  r+  c                \   K    | j                   j                  |fd| i| d{   S 7 w)z|coro|

        A shortcut method to :meth:`Guild.create_text_channel` to create a :class:`TextChannel` in the category.

        Returns
        -------
        :class:`TextChannel`
            The channel that was just created.
        rQ  N)rz   create_text_channelrN   rC   r   s      rO   r7  z#CategoryChannel.create_text_channel
  s/      4TZZ33DS4S7SSSS   #,*,c                \   K    | j                   j                  |fd| i| d{   S 7 w)z|coro|

        A shortcut method to :meth:`Guild.create_voice_channel` to create a :class:`VoiceChannel` in the category.

        Returns
        -------
        :class:`VoiceChannel`
            The channel that was just created.
        rQ  N)rz   create_voice_channelr8  s      rO   r;  z$CategoryChannel.create_voice_channel
  s/      5TZZ44TTDTGTTTTr9  c                \   K    | j                   j                  |fd| i| d{   S 7 w)a  |coro|

        A shortcut method to :meth:`Guild.create_stage_channel` to create a :class:`StageChannel` in the category.

        .. versionadded:: 1.7

        Returns
        -------
        :class:`StageChannel`
            The channel that was just created.
        rQ  N)rz   create_stage_channelr8  s      rO   r=  z$CategoryChannel.create_stage_channel  /      5TZZ44TTDTGTTTTr9  c                \   K    | j                   j                  |fd| i| d{   S 7 w)a  |coro|

        A shortcut method to :meth:`Guild.create_forum_channel` to create a :class:`ForumChannel` in the category.

        .. versionadded:: 2.0

        Returns
        -------
        :class:`ForumChannel`
            The channel that was just created.
        rQ  N)rz   create_forum_channelr8  s      rO   r@  z$CategoryChannel.create_forum_channel  r>  r9  )r_   r9   rz   r1   rf   CategoryChannelPayloadro   )rz   r1   rf   rA  rm   rn   r-  r,  r0  )rC   r2  r   r2  rm   r*   )rC   rJ   r   ra   r}   rl   rR  r  r   r2  rm   rd  )rm   rd  )rm   zlist[GuildChannelType])rm   zlist[TextChannel])rm   zlist[VoiceChannel])rm   zlist[StageChannel])rm   zlist[ForumChannel])rC   rJ   r   r   rm   r&   )rC   rJ   r   r   rm   r'   )rC   rJ   r   r   rm   r(   )rC   rJ   r   r   rm   r-   )rq   rr   rs   rt   ru   rP   rV   r   r;  r   r   r   r   r<  r   r   r2   r   r
   r   r  r   r*  r.  r1  r5  r7  r;  r=  r@  r=  r>  s   @rO   r*   r*   
  s   +Z
I"'"05"=S"
( * * $ $ U^^GKK,,223$(tU!U2<U	U 4U
  BE % % 	%
 % @% % 
 % % 7 7#' .U` U^^GKK,,112% 3%          
T
UUUrQ   r*   DMCr)   )boundc                      e Zd ZdZdZ	 	 	 	 	 	 ddZd ZddZddZe	dd       Z
edd       Zedd	       Zedd
       ZdddZddZy)r)   a  Represents a Discord direct message channel.

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the channel's hash.

        .. describe:: str(x)

            Returns a string representation of the channel

    Attributes
    ----------
    recipient: Optional[:class:`User`]
        The user you are participating with in the direct message channel.
        If this channel is received through the gateway, the recipient information
        may not be always available.
    me: :class:`ClientUser`
        The user presenting yourself.
    id: :class:`int`
        The direct message channel ID.
    )rD   	recipientmer|   c                   || _         d | _        |j                  d      x}r|j                  |d         | _        || _        t        |d         | _        y )N
recipientsr   rD   )r|   rE  rb   
store_userrF  ra   rD   )rN   rF  r_   rf   rs        rO   rP   zDMChannel.__init__K  sR     (-&*&&1&"--ad3DN 4:rQ   c                   K   | S wrX   rw   rU   s    rO   rK  zDMChannel._get_channelU  rL  rM  c                :    | j                   rd| j                    S y)NzDirect Message with z Direct Message with Unknown User)rE  rU   s    rO   rZ   zDMChannel.__str__X  s    >>)$..)9::1rQ   c                <    d| j                    d| j                  dS )Nz<DMChannel id=z recipient=rT   )rD   rE  rU   s    rO   rV   zDMChannel.__repr__]  s     yDNN3EQGGrQ   c                t    | j                  |       }||_        ||_        d |_        |j                  |_        |S rX   )r`   r|   rD   rE  r  rF  )re   r_   r  rN   s       rO   _from_messagezDMChannel._from_message`  s5    KK$**rQ   c                "    t         j                  S r   )r   r'  rU   s    rO   r   zDMChannel.typej  s     """rQ   c                     d| j                    S zdReturns a URL that allows the client to jump to the channel.

        .. versionadded:: 2.0
        z!https://discord.com/channels/@me/ru  rU   s    rO   jump_urlzDMChannel.jump_urlo       3477)<<rQ   c                @    t        j                  | j                        S )z:Returns the direct message channel's creation time in UTC.r   snowflake_timerD   rU   s    rO   
created_atzDMChannel.created_atw       ##DGG,,rQ   Nc               X    t        j                         }d|_        d|_        d|_        |S )a  Handles permission resolution for a :class:`User`.

        This function is there for compatibility with other channel types.

        Actual direct messages do not really have the concept of permissions.

        This returns all the Text related permissions set to ``True`` except:

        - :attr:`~Permissions.send_tts_messages`: You cannot send TTS messages in a DM.
        - :attr:`~Permissions.manage_messages`: You cannot delete others messages in a DM.

        Parameters
        ----------
        obj: :class:`User`
            The user to check permissions for. This parameter is ignored
            but kept for compatibility with other ``permissions_for`` methods.

        Returns
        -------
        :class:`Permissions`
            The resolved permissions.
        TF)r"   r   r   send_tts_messagesmanage_messagesrN   r   r   s      rO   r   zDMChannel.permissions_for|  s/    0 !!!&$rQ   c               "    ddl m}  || |      S r  r  r   s      rO   r!  zDMChannel.get_partial_message  r"  rQ   )rF  r>   r_   r9   rf   DMChannelPayloadro   )re   z	type[DMC]r_   r9   r  ra   rm   rB  r,  rm   zdatetime.datetimerX   )r   r   rm   r"   r:  )rq   rr   rs   rt   ru   rP   rK  rZ   rV   rv   rO  r;  r   rS  rX  r   r!  rw   rQ   rO   r)   r)   (  s    @ 4I''(7'?O'2
H   # # = = - -<;rQ   c                      e Zd ZdZdZ	 	 	 	 	 	 ddZddZd ZddZddZ	e
dd       Ze
dd	       Ze
dd
       Ze
dd       ZddZddZy)r+   a  Represents a Discord group channel.

    .. container:: operations

        .. describe:: x == y

            Checks if two channels are equal.

        .. describe:: x != y

            Checks if two channels are not equal.

        .. describe:: hash(x)

            Returns the channel's hash.

        .. describe:: str(x)

            Returns a string representation of the channel

    Attributes
    ----------
    recipients: List[:class:`User`]
        The users you are participating with in the group channel.
    me: :class:`ClientUser`
        The user presenting yourself.
    id: :class:`int`
        The group channel ID.
    owner: Optional[:class:`User`]
        The user that owns the group channel.
    owner_id: :class:`int`
        The owner ID that owns the group channel.

        .. versionadded:: 2.0
    name: Optional[:class:`str`]
        The group channel's name if provided.
    )rD   rH  owner_idowner_iconrC   rF  r|   c               h    || _         t        |d         | _        || _        | j	                  |       y r   )r|   ra   rD   rF  _update_group)rN   rF  r_   rf   s       rO   rP   zGroupChannel.__init__  s/     (-4: 4 rQ   c                    t        j                  |d       _        |j                  d       _        |j                  d       _        |j                  dg       D cg c]  } j                  j                  |       c} _           j                   j                  j                  k(  r j                   _        y t        j                   fd j                         _        y c c}w )Nrb  iconrC   rH  c                6    | j                   j                  k(  S rX   )rD   rb  )urN   s    rO   r'  z,GroupChannel._update_group.<locals>.<lambda>  s    adddmm.C rQ   )r   rc   rb  rb   rd  rC   r|   rI  rH  rF  rD   rc  find)rN   rf   rj  s   `  rO   rf  zGroupChannel._update_group  s    $)$;$;D*$M!%&!1
 $ 0	/3xxb/I'
*+DKK""1%'
 	==DGGJJ&DJ$CT__UDJ'
s   "C'c                   K   | S wrX   rw   rU   s    rO   rK  zGroupChannel._get_channel  rL  rM  c                    | j                   r| j                   S t        | j                        dk(  rydj                  t	        d | j                              S )Nr   Unnamedz, c                    | j                   S rX   rY   )xs    rO   r'  z&GroupChannel.__str__.<locals>.<lambda>  s
    qvv rQ   )rC   r   rH  r   maprU   s    rO   rZ   zGroupChannel.__str__  sB    9999t1$yy-t?@@rQ   c                <    d| j                    d| j                  dS )Nz<GroupChannel id=rS   rT   )rD   rC   rU   s    rO   rV   zGroupChannel.__repr__  s    "477)6$))a@@rQ   c                "    t         j                  S r   )r   grouprU   s    rO   r   zGroupChannel.type	  r  rQ   c                    | j                   yt        j                  | j                  | j                  | j                   d      S )z.Returns the channel's icon asset if available.Nr  )path)rd  r   
_from_iconr|   rD   rU   s    rO   rh  zGroupChannel.icon  s4     ::TWWdjjyQQrQ   c                @    t        j                  | j                        S )z+Returns the channel's creation time in UTC.rV  rU   s    rO   rX  zGroupChannel.created_at  rY  rQ   c                     d| j                    S rR  ru  rU   s    rO   rS  zGroupChannel.jump_url  rT  rQ   c                   t        j                         }d|_        d|_        d|_        d|_        |j                  | j                  k(  rd|_        |S )a  Handles permission resolution for a :class:`User`.

        This function is there for compatibility with other channel types.

        Actual direct messages do not really have the concept of permissions.

        This returns all the Text related permissions set to ``True`` except:

        - :attr:`~Permissions.send_tts_messages`: You cannot send TTS messages in a DM.
        - :attr:`~Permissions.manage_messages`: You cannot delete others messages in a DM.

        This also checks the kick_members permission if the user is the owner.

        Parameters
        ----------
        obj: :class:`~discord.abc.Snowflake`
            The user to check permissions for.

        Returns
        -------
        :class:`Permissions`
            The resolved permissions for the user.
        TF)	r"   r   r   r[  r\  mention_everyonerD   rb  kick_membersr]  s      rO   r   zGroupChannel.permissions_for"  sO    2 !!!&$ $66T]]" $DrQ   c                ~   K   | j                   j                  j                  | j                         d{    y7 w)z|coro|

        Leave the group.

        If you are the only one in the group, this deletes it as well.

        Raises
        ------
        HTTPException
            Leaving the group failed.
        N)r|   r   leave_grouprD   rU   s    rO   leavezGroupChannel.leaveF  s*      kk**477333s   3=;=N)rF  r>   r_   r9   rf   GroupChannelPayload)rf   r  rm   rn   ro   r,  )rm   zAsset | Noner`  )r   r/   rm   r"   )rm   rn   )rq   rr   rs   rt   ru   rP   rf  rK  rZ   rV   r;  r   rh  rX  rS  r   r  rw   rQ   rO   r+   r+     s    $L	I!!(7!?R!VAA ! ! R R - - = ="H4rQ   r+   c                  6    e Zd ZdZ	 d	 	 	 	 	 ddZddZd	dZy)
r,   aH  Represents a partial messageable to aid with working messageable channels when
    only a channel ID are present.

    The only way to construct this class is through :meth:`Client.get_partial_messageable`.

    Note that this class is trimmed down and has no rich attributes.

    .. versionadded:: 2.0

    .. container:: operations

        .. describe:: x == y

            Checks if two partial messageables are equal.

        .. describe:: x != y

            Checks if two partial messageables are not equal.

        .. describe:: hash(x)

            Returns the partial messageable's hash.

    Attributes
    ----------
    id: :class:`int`
        The channel ID associated with this partial messageable.
    type: Optional[:class:`ChannelType`]
        The channel type associated with this partial messageable, if given.
    Nc                P    || _         t        |      | _        || _        || _        y )Nru  )r|   r   _channelrD   r   )rN   r_   rD   r   s       rO   rP   zPartialMessageable.__init__v  s$     (- &"(,	rQ   c                "   K   | j                   S wrX   )r  rU   s    rO   rK  zPartialMessageable._get_channel~  s     }}s   c               "    ddl m}  || |      S )a  Creates a :class:`PartialMessage` from the message ID.

        This is useful if you want to work with a message and only have its ID without
        doing an unnecessary API call.

        Parameters
        ----------
        message_id: :class:`int`
            The message ID to create a partial message for.

        Returns
        -------
        :class:`PartialMessage`
            The partial message.
        r   r  r  r  r   s      rO   r!  z&PartialMessageable.get_partial_message  s    " 	,dz::rQ   rX   )r_   r9   rD   ra   r   rg  )rm   r   r:  )rq   rr   rs   rt   rP   rK  r!  rw   rQ   rO   r,   r,   V  s6    @ KO-$-*--5G-;rQ   r,   c                b   t        t        |       }|t        j                  u rt        |fS |t        j                  u rt
        |fS |t        j                  u rt        |fS |t        j                  u rt        |fS |t        j                  u rt        |fS |t        j                  u rt        |fS d |fS rX   )r   r   r   r&   r   r'   rQ  r*   rG  r  r(   forumr-   )channel_typer   s     rO   _guild_channel_factoryr    s    [,/E   E!!	+##	#U""	+&&	&%%	+""	"E!!	+))	)U""	+##	#U""U{rQ   c                    t        |       \  }}|t        j                  u rt        |fS |t        j                  u rt
        |fS ||fS rX   )r  r   r'  r)   rt  r+   r  re   r   s      rO   _channel_factoryr    sL    '5JC###%	+##	#U""EzrQ   c                    t        |       \  }}|t        j                  t        j                  t        j                  fv rt
        |fS ||fS rX   )r  r   r_  public_threadnews_threadr$   r  s      rO   _threaded_channel_factoryr    sN    !,/JC""!! 
 u}:rQ   c                    t        |       \  }}|t        j                  t        j                  t        j                  fv rt
        |fS ||fS rX   )r  r   r_  r  r  r$   r  s      rO   _threaded_guild_channel_factoryr    sN    '5JC""!! 
 u}:rQ   )r  ra   )prt   
__future__r   datetimetypingr   r   r   r   r   r	   r
   discord.abcr   r]   r   assetr   rF   r   enumsr   r   r   r   r   r   r   r   errorsr   r   r}  r   r   r   inviter   	iteratorsr   mixinsr   objectr   partial_emojir   r    permissionsr!   r"   stage_instancer#   r   r$   r%   __all__r   r/   r0   rz   r1   r2   GuildChannelTyper  r3   r4   r  r5   r6   r7   roler8   r_   r9   types.channelr*   rA  r)   r_  r-   r  r.   rp   r:   r  r(   r  r&   rc  r'   r  types.snowflaker;   types.threadsr<   r  r=   r>   r?   r   rA   ry   MessageableConnectabler  rB  r+   r,   r  r  r  r  rw   rQ   rO   <module>r     s  2 #  U U U    	 	 	 5    -   2 9 )  
 -7*@@&H<B:DB@B.400 Wx Wtm
7;;++X m
`IF'++))< IFXT< Tno//1I1I8 odUX7;;**,= UXpoU7;;**,= oUd\Ugkk.. \U~ e;'G;'' G;Ta47;;**H a4H>;00( >;B$rQ   