mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-06 18:11:59 +00:00
Clarify actions that require manage_threads permission
This commit is contained in:
parent
5a72391b72
commit
d0d2d7ea62
@ -674,7 +674,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
"""Returns an :class:`~discord.AsyncIterator` that iterates over all archived threads in the guild.
|
"""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
|
You must have :attr:`~Permissions.read_message_history` to use this. If iterating over private threads
|
||||||
then :attr:`~Permissions.manage_messages` is also required.
|
then :attr:`~Permissions.manage_threads` is also required.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
|
@ -698,6 +698,7 @@ class HTTPClient:
|
|||||||
'video_quality_mode',
|
'video_quality_mode',
|
||||||
'archived',
|
'archived',
|
||||||
'auto_archive_duration',
|
'auto_archive_duration',
|
||||||
|
'locked',
|
||||||
)
|
)
|
||||||
payload = {k: v for k, v in options.items() if k in valid_keys}
|
payload = {k: v for k, v in options.items() if k in valid_keys}
|
||||||
return self.request(r, reason=reason, json=payload)
|
return self.request(r, reason=reason, json=payload)
|
||||||
|
@ -103,6 +103,8 @@ class Thread(Messageable, Hashable):
|
|||||||
This could not be available.
|
This could not be available.
|
||||||
archived: :class:`bool`
|
archived: :class:`bool`
|
||||||
Whether the thread is archived.
|
Whether the thread is archived.
|
||||||
|
locked: :class:`bool`
|
||||||
|
Whether the thread is locked.
|
||||||
archiver_id: Optional[:class:`int`]
|
archiver_id: Optional[:class:`int`]
|
||||||
The user's ID that archived this thread.
|
The user's ID that archived this thread.
|
||||||
auto_archive_duration: :class:`int`
|
auto_archive_duration: :class:`int`
|
||||||
@ -215,11 +217,19 @@ class Thread(Messageable, Hashable):
|
|||||||
return self._state._get_message(self.last_message_id) if self.last_message_id else None
|
return self._state._get_message(self.last_message_id) if self.last_message_id else None
|
||||||
|
|
||||||
def is_private(self) -> bool:
|
def is_private(self) -> bool:
|
||||||
""":class:`bool`: Whether the thread is a private thread."""
|
""":class:`bool`: Whether 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`.
|
||||||
|
"""
|
||||||
return self._type is ChannelType.private_thread
|
return self._type is ChannelType.private_thread
|
||||||
|
|
||||||
def is_news(self) -> bool:
|
def is_news(self) -> bool:
|
||||||
""":class:`bool`: Whether the thread is a news thread."""
|
""":class:`bool`: Whether 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``.
|
||||||
|
"""
|
||||||
return self._type is ChannelType.news_thread
|
return self._type is ChannelType.news_thread
|
||||||
|
|
||||||
async def edit(
|
async def edit(
|
||||||
@ -227,14 +237,20 @@ class Thread(Messageable, Hashable):
|
|||||||
*,
|
*,
|
||||||
name: str = MISSING,
|
name: str = MISSING,
|
||||||
archived: bool = MISSING,
|
archived: bool = MISSING,
|
||||||
|
locked: bool = MISSING,
|
||||||
|
slowmode_delay: int = MISSING,
|
||||||
auto_archive_duration: ThreadArchiveDuration = MISSING,
|
auto_archive_duration: ThreadArchiveDuration = MISSING,
|
||||||
):
|
):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Edits the thread.
|
Edits the thread.
|
||||||
|
|
||||||
To unarchive a thread :attr:`~.Permissions.send_messages` is required. Otherwise,
|
Editing the thread requires :attr:`.Permissions.manage_threads`. The thread
|
||||||
:attr:`~.Permissions.manage_messages` is required to edit 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 unarchive a thread.
|
||||||
|
|
||||||
|
The thread must be unarchived to be edited.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
------------
|
------------
|
||||||
@ -242,8 +258,14 @@ class Thread(Messageable, Hashable):
|
|||||||
The new name of the thread.
|
The new name of the thread.
|
||||||
archived: :class:`bool`
|
archived: :class:`bool`
|
||||||
Whether to archive the thread or not.
|
Whether to archive the thread or not.
|
||||||
|
locked: :class:`bool`
|
||||||
|
Whether to lock the thread or not.
|
||||||
auto_archive_duration: :class:`int`
|
auto_archive_duration: :class:`int`
|
||||||
The new duration to auto archive threads for inactivity.
|
The new duration to auto archive threads 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``.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
@ -259,6 +281,11 @@ class Thread(Messageable, Hashable):
|
|||||||
payload['archived'] = archived
|
payload['archived'] = archived
|
||||||
if auto_archive_duration is not MISSING:
|
if auto_archive_duration is not MISSING:
|
||||||
payload['auto_archive_duration'] = auto_archive_duration
|
payload['auto_archive_duration'] = auto_archive_duration
|
||||||
|
if locked is not MISSING:
|
||||||
|
payload['locked'] = locked
|
||||||
|
if slowmode_delay is not MISSING:
|
||||||
|
payload['rate_limit_per_user'] = slowmode_delay
|
||||||
|
|
||||||
await self._state.http.edit_channel(self.id, **payload)
|
await self._state.http.edit_channel(self.id, **payload)
|
||||||
|
|
||||||
async def join(self):
|
async def join(self):
|
||||||
@ -321,7 +348,7 @@ class Thread(Messageable, Hashable):
|
|||||||
|
|
||||||
Removes a user from this thread.
|
Removes a user from this thread.
|
||||||
|
|
||||||
You must have :attr:`~Permissions.manage_messages` or be the creator of the thread to remove a user.
|
You must have :attr:`~Permissions.manage_threads` or be the creator of the thread to remove a user.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
@ -342,7 +369,7 @@ class Thread(Messageable, Hashable):
|
|||||||
|
|
||||||
Deletes this thread.
|
Deletes this thread.
|
||||||
|
|
||||||
You must have :attr:`~Permissions.manage_channels` to delete threads.
|
You must have :attr:`~Permissions.manage_threads` to delete threads.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user