
    cjhw                    f   d Z ddlmZ ddlmZmZmZ ddlmZm	Z	 ddl
mZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZmZ dZerXddlmZmZ ddlmZmZmZmZ ddlm Z  ddl!m"Z" ddl#m$Z$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z0 ddl.m1Z1 ddl.m2Z3 ddl.m4Z4  G d dee      Z/ G d de      Z2y)ae  
The MIT License (MIT)

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

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

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotations)TYPE_CHECKINGCallableIterable   )Messageable_purge_messages_helper)ChannelTypetry_enum)ClientException)ChannelFlags)Hashable)MISSING_get_as_snowflake
parse_time)ThreadThreadMember)	SnowflakeSnowflakeTime)CategoryChannelForumChannelForumTagTextChannel)Guild)Member)MessagePartialMessage)Permissions)Role)ConnectionState)SnowflakeList)r   )ThreadArchiveDuration)r   )ThreadMetadatac            
      &   e Zd ZdZdZd/dZd Zd0dZd0dZd1dZ	d2dZ
d	 Zed3d
       Zed4d       Zed5d       Zed0d       Zed0d       Zed6d       Zed7d       Zed8d       Zed9d       Zed:d       Zed8d       Zd;dZd;dZd;dZd;dZd<dZdd	 	 	 	 	 d=dZdeddddddd 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d>d!Zeeeeeeeedd"		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d?d#Z efd@d$Z!dAd%Z"d& Z#d' Z$dBd(Z%dBd)Z&d6d*Z'd+ Z(dCd,Z)dDd-Z*dEd.Z+y)Fr   a
  Represents a Discord thread.

    .. container:: operations

        .. describe:: x == y

            Checks if two threads are equal.

        .. describe:: x != y

            Checks if two threads are not equal.

        .. describe:: hash(x)

            Returns the thread's hash.

        .. describe:: str(x)

            Returns the thread's name.

    .. versionadded:: 2.0

    Attributes
    ----------
    name: :class:`str`
        The thread name.
    guild: :class:`Guild`
        The guild the thread belongs to.
    id: :class:`int`
        The thread ID.

        .. note::
            This ID is the same as the thread starting message ID.

    parent_id: :class:`int`
        The parent :class:`TextChannel` ID this thread belongs to.
    owner_id: :class:`int`
        The user's ID that created this thread.
    last_message_id: Optional[:class:`int`]
        The last message ID of the message sent to this thread. 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 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.
    message_count: :class:`int`
        An approximate number of messages in this thread. This caps at 50.
    member_count: :class:`int`
        An approximate number of members in this thread. This caps at 50.
    me: Optional[:class:`ThreadMember`]
        A thread member representing yourself, if you've joined the thread.
        This could not be available.
    archived: :class:`bool`
        Whether the thread is archived.
    locked: :class:`bool`
        Whether the thread is locked.
    invitable: :class:`bool`
        Whether non-moderators can add other non-moderators to this thread.
        This is always ``True`` for public threads.
    auto_archive_duration: :class:`int`
        The duration in minutes until the thread is automatically archived due to inactivity.
        Usually a value of 60, 1440, 4320 and 10080.
    archive_timestamp: :class:`datetime.datetime`
        An aware timestamp of when the thread's archived status was last updated in UTC.
    created_at: Optional[:class:`datetime.datetime`]
        An aware timestamp of when the thread was created.
        Only available for threads created after 2022-01-09.
    flags: :class:`ChannelFlags`
        Extra features of the thread.

        .. versionadded:: 2.0
    total_message_sent: :class:`int`
        Number of messages ever sent in a thread.
        It's similar to message_count on message creation,
        but will not decrement the number when a message is deleted.

        .. versionadded:: 2.3
    )nameidguild_type_state_members_applied_tagsowner_id	parent_idlast_message_idmessage_countmember_countslowmode_delaymelockedarchived	invitableauto_archive_durationarchive_timestamp
created_atflagstotal_message_sentc               P    || _         || _        i | _        | j                  |       y N)r)   r'   r*   
_from_data)selfr'   statedatas       B/var/www/html/venv/lib/python3.12/site-packages/discord/threads.py__init__zThread.__init__   s#    ',
13    c                   K   | S wr<    r>   s    rA   _get_channelzThread._get_channel   s     s   c                    d| j                   d| j                  d| j                   d| j                  d| j                   d| j
                   dS )Nz<Thread id=z name=z parent=z
 owner_id=z locked=z
 archived=>)r&   r%   parentr,   r3   r4   rF   s    rA   __repr__zThread.__repr__   sO    $''F499-x})$++jWXZ	
rC   c                    | j                   S r<   )r%   rF   s    rA   __str__zThread.__str__   s    yyrC   c                    t        |d         | _        t        |d         | _        |d   | _        t	        t
        |d         | _        |j                  dd       t        |j                  d            nd | _        t        |d      | _
        |j                  dd      | _        |j                  d	d       | _        |j                  d
d       | _        t        j                  |j                  dd            | _        |j                  dd       | _        |j                  dg       D cg c]  }t        |       c}| _        | j&                  j)                  | j                        xr |j+                  dd      x}r| j                  |j                  n| j                  | _        | j                  |j                  n| j                  | _
        | j                  |j                  n| j                  | _        | j"                  |j"                  n| j"                  | _        | j                  |j                  n| j                  | _        | j-                  |d          	 |d   }t/        | |      | _        y c c}w # t2        $ r
 d | _        Y y w xY w)Nr&   r-   r%   typer,   r.   rate_limit_per_userr   r/   r0   r9   r:   applied_tags_invoke_flagFthread_metadatamember)intr&   r-   r%   r   r
   r(   getr,   r   r.   r1   r/   r0   r   _from_valuer9   r:   r+   r'   
get_threadpop_unroll_metadatar   r2   KeyError)r>   r@   tag_idthreadrT   s        rA   r=   zThread._from_data   sT   d4j/T+./L	k4<8

 xx
D)5 $% 	
  17HI"hh'<a@!XXot< HH^T:#/#;#;DHHWa<P#Q
"&((+?"F&*hh~r&B)
"CK)

 ZZ**4773WQV8WW6W/3}}/DFOO$--DM ''/ &&))   %%- $$''  **2 )),, # (,'8'8'@##dFWFW  	d#456	1(^F #40DGC)
<  	DG	s   'I5I: :JJc                    |d   | _         |d   | _        t        |d         | _        |d   | _        |j                  dd      | _        t        |j                  dd             | _        y )Nr4   r6   r7   r3   r5   Tcreate_timestamp)r4   r6   r   r7   r3   rV   r5   r8   r>   r@   s     rA   rZ   zThread._unroll_metadata   sd    Z(%)*A%B"!+D1D,E!F8n+t4$TXX.@$%GHrC   c                h   	 |d   | _         |j                  dg       D cg c]  }t        |       c}| _        t        j                  |j                  dd            | _        |j                  dd      | _        	 | j                  |d          y # t        $ r Y w xY wc c}w # t        $ r Y y w xY w)Nr%   rQ   r9   r   rP   rS   )
r%   r[   rV   rU   r+   r   rW   r9   r1   rZ   )r>   r@   r\   s      rA   _updatezThread._update   s    	VDI
 '+hh~r&B)
"CK)
 $0#;#;DHHWa<P#Q
"hh'<a@	!!$'8"9:  		)
  		s(   
B B <B% 	BB%	B10B1c                    | j                   S )zThe channel's Discord type.)r(   rF   s    rA   rO   zThread.type  s     zzrC   c                L    | j                   j                  | j                        S )z*The parent channel this thread belongs to.)r'   get_channelr-   rF   s    rA   rJ   zThread.parent
  s     zz%%dnn55rC   c                L    | j                   j                  | j                        S )z"The member this thread belongs to.)r'   
get_memberr,   rF   s    rA   ownerzThread.owner  s     zz$$T]]33rC   c                "    d| j                    dS )z1The string that allows you to mention the thread.z<#rI   )r&   rF   s    rA   mentionzThread.mention  s     DGG9ArC   c                N    d| j                   j                   d| j                   S )zcReturns a URL that allows the client to jump to the thread.

        .. versionadded:: 2.0
        zhttps://discord.com/channels//)r'   r&   rF   s    rA   jump_urlzThread.jump_url  s#     /tzz}}oQtwwiHHrC   c                H    t        | j                  j                               S )a-  A list of thread members in this thread, including the bot if it is a member of this thread.

        This requires :attr:`Intents.members` to be properly filled. Most of the time however,
        this data is not provided by the gateway and a call to :meth:`fetch_members` is
        needed.
        )listr*   valuesrF   s    rA   memberszThread.members!  s     DMM((*++rC   c                    ddl m} t        | j                  |      r7| j                  D cg c]!  }| j                  j                  |      x}|# c}S g S c c}w )zList[:class:`ForumTag`]: A list of tags applied to this thread.

        This is only available for threads in forum channels.
        r   )r   )channelr   
isinstancerJ   r+   get_tag)r>   r   r\   tags       rA   rQ   zThread.applied_tags+  s^     	*dkk<0 #00;;..v66CC  
 	s   &Ac                h    | j                   r%| j                  j                  | j                         S dS )a5  Returns the last message from this thread 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_messagerF   s    rA   last_messagezThread.last_message;  s6    * ## KK$$T%9%9:	
 	
rC   c                L    | j                   }|t        d      |j                  S )a>  The category channel the parent channel belongs to, if applicable.

        Returns
        -------
        Optional[:class:`CategoryChannel`]
            The parent channel's category.

        Raises
        ------
        ClientException
            The parent channel was not cached and returned ``None``.
        Parent channel not found)rJ   r   categoryr>   rJ   s     rA   r|   zThread.categoryT  s(     >!"<==rC   c                L    | j                   }|t        d      |j                  S )a8  The category channel ID the parent channel belongs to, if applicable.

        Returns
        -------
        Optional[:class:`int`]
            The parent channel's category ID.

        Raises
        ------
        ClientException
            The parent channel was not cached and returned ``None``.
        r{   )rJ   r   category_idr}   s     rA   r   zThread.category_idh  s*     >!"<==!!!rC   c                L    | j                   j                  | j                        S )ap  Returns the message that started this thread.

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

        .. note::
            The ID for this message is the same as the thread ID.

        Returns
        -------
        Optional[:class:`Message`]
            The message that started this thread or ``None`` if not found in the cache.
        )r)   rx   r&   rF   s    rA   starting_messagezThread.starting_message|  s     {{''00rC   c                .    | j                   j                  S )zlWhether the thread is pinned to the top of its parent forum channel.

        .. versionadded:: 2.3
        )r9   pinnedrF   s    rA   	is_pinnedzThread.is_pinned  s    
 zz   rC   c                :    | j                   t        j                  u S )zWhether the thread is a private thread.

        A private thread is only viewable by those that have been explicitly
        invited or have :attr:`~.Permissions.manage_threads`.
        )r(   r
   private_threadrF   s    rA   
is_privatezThread.is_private  s     zz[7777rC   c                :    | j                   t        j                  u S )zWhether the thread is a news thread.

        A news thread is a thread that has a parent that is a news channel,
        i.e. :meth:`.TextChannel.is_news` is ``True``.
        )r(   r
   news_threadrF   s    rA   is_newszThread.is_news  s     zz[4444rC   c                F    | j                   }|duxr |j                         S )zWhether the thread is NSFW or not.

        An NSFW thread is a thread that has a parent that is an NSFW channel,
        i.e. :meth:`.TextChannel.is_nsfw` is ``True``.
        N)rJ   is_nsfwr}   s     rA   r   zThread.is_nsfw  s$     T!6fnn&66rC   c               V    | j                   }|t        d      |j                  |      S )ak  Handles permission resolution for the :class:`~discord.Member`
        or :class:`~discord.Role`.

        Since threads do not have their own permissions, they inherit them
        from the parent channel. This is a convenience method for
        calling :meth:`~discord.TextChannel.permissions_for` on the
        parent channel.

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

        Returns
        -------
        :class:`~discord.Permissions`
            The resolved permissions for the member or role.

        Raises
        ------
        ClientException
            The parent channel was not cached and returned ``None``
        r{   )rJ   r   permissions_for)r>   objrJ   s      rA   r   zThread.permissions_for  s/    6 >!"<==%%c**rC   Nreasonc                 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.

        Usable only by bot accounts.

        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, or
            you're not using a bot account.
        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)
rt   ro   tuplelenr&   r)   httpdelete_messager   delete_messages)r>   messagesr   
message_idmmessage_idss         rA   r   zThread.delete_messages  s     N (T5M2H~Hx=Ax=A!!J++""11$'':f1UUUx=3!"TUU4<%=qadd%=%=kk..twwF.SSS V &>Ss0   BDC8"D(C:;7D2C?3D:Dr   FTlimitcheckbeforeafteraroundoldest_firstbulkr   c               F   K   t        | ||||||||	       d{   S 7 w)ae	  |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 (unless you are a user
        account). 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 thread.purge(limit=100, check=is_me)
            await thread.send(f'Deleted {len(deleted)} message(s)')
        r   N)r	   )	r>   r   r   r   r   r   r   r   r   s	            rA   purgezThread.purge  s;     J ,%

 

 
	
 

s   !!)	r%   r4   r3   r5   r1   r6   r   rQ   r   c       	        `  K   i }
|t         urt        |      |
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur?t        j                  | j                  j
                        }||_        |j
                  |
d<   |t         ur|D cg c]  }|j                   c}|
d<    | j                  j                  j                  | j                  fi |
d	|	i d
{   }t        || j                  | j                        S c c}w 7 +w)a  |coro|

        Edits the thread.

        Editing the thread requires :attr:`.Permissions.manage_threads`. The thread
        creator can also edit ``name``, ``archived`` or ``auto_archive_duration``.
        Note that if the thread is locked then only those with :attr:`.Permissions.manage_threads`
        can send messages in it or unarchive a thread.

        The thread must be unarchived to be edited.

        Parameters
        ----------
        name: :class:`str`
            The new name of the thread.
        archived: :class:`bool`
            Whether to archive the thread or not.
        locked: :class:`bool`
            Whether to lock the thread or not.
        invitable: :class:`bool`
            Whether non-moderators can add other non-moderators to this thread.
            Only available for private threads.
        auto_archive_duration: :class:`int`
            The new duration in minutes before a thread is automatically archived for inactivity.
            Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
        slowmode_delay: :class:`int`
            Specifies the slowmode rate limit for user in this thread, in seconds.
            A value of ``0`` disables slowmode. The maximum value possible is ``21600``.
        reason: Optional[:class:`str`]
            The reason for editing this thread. Shows up on the audit log.
        pinned: :class:`bool`
            Whether to pin the thread or not. This only works if the thread is part of a forum.
        applied_tags: List[:class:`ForumTag`]
            The set of tags to apply to the thread. Each tag object should have an ID set.

            .. versionadded:: 2.3

        Returns
        -------
        :class:`Thread`
            The newly edited thread.

        Raises
        ------
        Forbidden
            You do not have permissions to edit the thread.
        HTTPException
            Editing the thread failed.
        r%   r4   r6   r3   r5   rP   r9   rQ   r   N)r@   r?   r'   )r   strr   rW   r9   valuer   r&   r)   r   edit_channelr   r'   )r>   r%   r4   r3   r5   r1   r6   r   rQ   r   payloadr9   rv   r@   s                 rA   editzThread.editU  s$    | w!$iGFO7""*GJ //DG+,  &GHG##,GK (-;G)*  ,,TZZ-=-=>E!EL${{GGw&9E&F#svv&FGN#2T[[%%22477UgUfUU4t{{$**EE	 'GUs   B-D./D'>D. D,,D.c                D   K   | j                  d|       d{   S 7 w)a<  |coro|

        Archives the thread. This is a shorthand of :meth:`.edit`.

        Parameters
        ----------
        locked: :class:`bool`
            Whether to lock the thread on archive, Defaults to ``False``.

        Returns
        -------
        :class:`.Thread`
            The updated thread.
        T)r4   r3   Nr   )r>   r3   s     rA   archivezThread.archive  s!      YYVY<<<<s     c                B   K   | j                  d       d{   S 7 w)z|coro|

        Unarchives the thread. This is a shorthand of :meth:`.edit`.

        Returns
        -------
        :class:`.Thread`
            The updated thread.
        F)r4   Nr   rF   s    rA   	unarchivezThread.unarchive  s      YYY....s   c                ~   K   | j                   j                  j                  | j                         d{    y7 w)a  |coro|

        Joins this thread.

        You must have :attr:`~Permissions.send_messages_in_threads` to join a thread.
        If the thread is private, :attr:`~Permissions.manage_threads` is also needed.

        Raises
        ------
        Forbidden
            You do not have permissions to join the thread.
        HTTPException
            Joining the thread failed.
        N)r)   r   join_threadr&   rF   s    rA   joinzThread.join  s*      kk**477333   3=;=c                ~   K   | j                   j                  j                  | j                         d{    y7 w)z|coro|

        Leaves this thread.

        Raises
        ------
        HTTPException
            Leaving the thread failed.
        N)r)   r   leave_threadr&   rF   s    rA   leavezThread.leave  s*      kk++DGG444r   c                   K   | j                   j                  j                  | j                  |j                         d{    y7 w)a]  |coro|

        Adds a user to this thread.

        You must have :attr:`~Permissions.send_messages_in_threads`
        to add a user to a public thread. If the thread is private and
        :attr:`invitable` is ``False``, then
        :attr:`~Permissions.manage_threads` is required.

        Parameters
        ----------
        user: :class:`abc.Snowflake`
            The user to add to the thread.

        Raises
        ------
        Forbidden
            You do not have permissions to add the user to the thread.
        HTTPException
            Adding the user to the thread failed.
        N)r)   r   add_user_to_threadr&   r>   users     rA   add_userzThread.add_user  s0     , kk11$''477CCC   >A AAc                   K   | j                   j                  j                  | j                  |j                         d{    y7 w)a  |coro|

        Removes a user from this thread.

        You must have :attr:`~Permissions.manage_threads` or be the creator of the thread to remove a user.

        Parameters
        ----------
        user: :class:`abc.Snowflake`
            The user to remove from the thread.

        Raises
        ------
        Forbidden
            You do not have permissions to remove the user from the thread.
        HTTPException
            Removing the user from the thread failed.
        N)r)   r   remove_user_from_threadr&   r   s     rA   remove_userzThread.remove_user  s0     & kk66twwHHHr   c                   K   | j                   j                  j                  | j                         d{   }|D cg c]  }t	        | |       }}|D ]  }| j                  |        |S 7 8c c}w w)a  |coro|

        Retrieves all :class:`ThreadMember` that are in this thread.

        This requires :attr:`Intents.members` to get information about members
        other than yourself.

        Returns
        -------
        List[:class:`ThreadMember`]
            All thread members in the thread.

        Raises
        ------
        HTTPException
            Retrieving the members failed.
        N)rJ   r@   )r)   r   get_thread_membersr&   r   _add_member)r>   rq   r@   thread_membersrT   s        rA   fetch_memberszThread.fetch_members  sq     & ((;;DGGDDKRS4,d>SS$ 	%FV$	%  ESs    3A5A.A5A0A50A5c                ~   K   | j                   j                  j                  | j                         d{    y7 w)a)  |coro|

        Deletes this thread.

        You must have :attr:`~Permissions.manage_threads` to delete threads.

        Raises
        ------
        Forbidden
            You do not have permissions to delete this thread.
        HTTPException
            Deleting the thread failed.
        N)r)   r   delete_channelr&   rF   s    rA   deletezThread.delete/  s*      kk--dgg666r   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:: 2.0

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

        Returns
        -------
        :class:`PartialMessage`
            The partial message.
        r   )r   )rs   r&   )messager   )r>   r   r   s      rA   get_partial_messagezThread.get_partial_message?  s    & 	,dz::rC   c                6    || j                   |j                  <   y r<   )r*   r&   )r>   rT   s     rA   r   zThread._add_memberV  s    #)fii rC   c                :    | j                   j                  |d       S r<   )r*   rY   )r>   	member_ids     rA   _pop_memberzThread._pop_memberY  s    }}  D11rC   )r'   r   r?   r    r@   ThreadPayloadreturnr   )r@   r   )r@   r#   )r   r
   )r   z!TextChannel | ForumChannel | None)r   zMember | None)r   zlist[ThreadMember])r   list[ForumTag])r   zMessage | None)r   zCategoryChannel | None)r   
int | None)r   bool)r   zMember | Roler   r   )r   zIterable[Snowflake]r   
str | Noner   None)r   r   r   zCallable[[Message], bool]r   SnowflakeTime | Noner   r   r   r   r   zbool | Noner   r   r   r   r   zlist[Message])r%   r   r4   r   r3   r   r5   r   r1   rU   r6   r"   r   r   rQ   r   r   r   r   r   )r3   r   r   r   r   r   )r   r   )r   rU   r   r   )rT   r   r   r   )r   rU   r   zThreadMember | None),__name__
__module____qualname____doc__	__slots__rB   rG   rK   rM   r=   rZ   rb   propertyrO   rJ   rh   rj   rm   rq   rQ   ry   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rE   rC   rA   r   r   :   s   N`I2
41lI"   6 6 4 4   I I , ,   
 
0  & " "& 1 1!857+B FJ6T+6T8B6T	6Tv  +2'+&*'+$)!O
 O
 )	O

 %O
 $O
 %O
 "O
 O
 O
 
O
h  !%7>'.!UF UF 	UF
 UF UF UF  5UF UF %UF UF 
UFn ,3 ="
/4"
5D0I*87 ;.*2rC   r   c                  >    e Zd ZdZdZddZd	dZd
dZedd       Z	y)r   a  Represents a Discord thread member.

    .. container:: operations

        .. describe:: x == y

            Checks if two thread members are equal.

        .. describe:: x != y

            Checks if two thread members are not equal.

        .. describe:: hash(x)

            Returns the thread member's hash.

        .. describe:: str(x)

            Returns the thread member's name.

    .. versionadded:: 2.0

    Attributes
    ----------
    id: :class:`int`
        The thread member's ID.
    thread_id: :class:`int`
        The thread's ID.
    joined_at: :class:`datetime.datetime`
        The time the member joined the thread in UTC.
    )r&   	thread_id	joined_atr9   r)   rJ   c                V    || _         |j                  | _        | j                  |       y r<   )rJ   r)   r=   )r>   rJ   r@   s      rA   rB   zThreadMember.__init__  s     mmrC   c                V    d| j                    d| j                   d| j                  dS )Nz<ThreadMember id=z thread_id=z joined_at=rI   )r&   r   r   rF   s    rA   rK   zThreadMember.__repr__  s4    77);t~~&6k$..ASSTV	
rC   c                f   	 t        |d         | _        	 t        |d         | _        t        |d         | _        |d   | _	        y # t        $ r6 | j                  j                  J | j                  j                  | _        Y pw xY w# t        $ r | j                  j                  | _        Y w xY w)Nuser_idr&   join_timestampr9   )
rU   r&   r[   r)   self_idr   rJ   r   r   r9   r`   s     rA   r=   zThreadMember._from_data  s    	*$y/*DG
	, d_DN $D)9$:;']
  	*;;&&222kk))DG	*  	,![[^^DN	,s"   A B	 <BB	$B0/B0c                    | j                   S )z"The thread this member belongs to.)rJ   rF   s    rA   r]   zThreadMember.thread  s     {{rC   N)rJ   r   r@   ThreadMemberPayloadr   )r@   r   r   )
r   r   r   r   r   rB   rK   r=   r   r]   rE   rC   rA   r   r   ]  s2    @I

#  rC   r   N)5r   
__future__r   typingr   r   r   abcr   r	   enumsr
   r   errorsr   r9   r   mixinsr   utilsr   r   r   __all__r   r   rs   r   r   r   r   r'   r   rT   r   r   r   r   permissionsr   roler   r?   r    types.snowflaker!   types.threadsr   r   r"   r   r   r#   rE   rC   rA   <module>r      s   2 # 4 4 4 ( #   9 9
 -MM0(&.64B-`2[( `2FG8 GrC   