aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Gayfer <[email protected]>2021-08-26 12:53:21 -0700
committerGitHub <[email protected]>2021-08-26 15:53:21 -0400
commit4aafa39e8ca7fcdc7acd34295eed41bd3700d44b (patch)
treed8eff72e401238faed88484a8bd18687943dd8fb
parentAdd support for invitable thread option (diff)
downloaddiscord.py-4aafa39e8ca7fcdc7acd34295eed41bd3700d44b.tar.xz
discord.py-4aafa39e8ca7fcdc7acd34295eed41bd3700d44b.zip
Update thread permissions
Discord has renamed / repurposed "Use Public Threads" and "Use Private Threads", as well as added a new permission "Send Messages in Threads". For more information, see: https://github.com/discord/discord-api-docs/pull/3672
-rw-r--r--discord/channel.py11
-rw-r--r--discord/message.py4
-rw-r--r--discord/permissions.py36
-rw-r--r--discord/threads.py6
4 files changed, 29 insertions, 28 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 6e025a99..be3315cf 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -684,15 +684,8 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
Creates a thread in this text channel.
- If no starter message is passed with the ``message`` parameter then
- you must have :attr:`~discord.Permissions.send_messages` and
- :attr:`~discord.Permissions.use_private_threads` in order to create the thread
- if the ``type`` parameter is :attr:`~discord.ChannelType.private_thread`.
- Otherwise :attr:`~discord.Permissions.use_threads` is needed.
-
- If a starter message is passed with the ``message`` parameter then
- you must have :attr:`~discord.Permissions.send_messages` and
- :attr:`~discord.Permissions.use_threads` in order to create the thread.
+ 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
diff --git a/discord/message.py b/discord/message.py
index 14b7fee4..304c807d 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -1496,8 +1496,8 @@ class Message(Hashable):
Creates a public thread from this message.
- You must have :attr:`~discord.Permissions.send_messages` and
- :attr:`~discord.Permissions.use_threads` in order to create a thread.
+ You must have :attr:`~discord.Permissions.create_public_threads` in order to
+ create a public thread from a message.
The channel this message belongs in must be a :class:`TextChannel`.
diff --git a/discord/permissions.py b/discord/permissions.py
index 8e918298..240f4aed 100644
--- a/discord/permissions.py
+++ b/discord/permissions.py
@@ -147,7 +147,7 @@ class Permissions(BaseFlags):
"""A factory method that creates a :class:`Permissions` with all
permissions set to ``True``.
"""
- return cls(0b11111111111111111111111111111111111111)
+ return cls(0b111111111111111111111111111111111111111)
@classmethod
def all_channel(cls: Type[P]) -> P:
@@ -169,10 +169,11 @@ class Permissions(BaseFlags):
Added :attr:`stream`, :attr:`priority_speaker` and :attr:`use_slash_commands` permissions.
.. versionchanged:: 2.0
- Added :attr:`use_threads`, :attr:`use_private_threads`, :attr:`manage_threads`,
- :attr:`use_external_stickers` and :attr:`request_to_speak` permissions.
+ Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
+ :attr:`use_external_stickers`, :attr:`send_messages_in_threads` and
+ :attr:`request_to_speak` permissions.
"""
- return cls(0b11110110110011111101111111111101010001)
+ return cls(0b111101101100111111011111111111010100011)
@classmethod
def general(cls: Type[P]) -> P:
@@ -206,10 +207,10 @@ class Permissions(BaseFlags):
Added :attr:`use_slash_commands` permission.
.. versionchanged:: 2.0
- Added :attr:`use_threads`, :attr:`use_private_threads`, :attr:`manage_threads`
- and :attr:`use_external_stickers` permissions.
+ Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
+ :attr:`send_messages_in_threads` and :attr:`use_external_stickers` permissions.
"""
- return cls(0b11110010000000000001111111100001000000)
+ return cls(0b111110010000000000001111111100001000000)
@classmethod
def voice(cls: Type[P]) -> P:
@@ -511,16 +512,16 @@ class Permissions(BaseFlags):
return 1 << 34
@flag_value
- def use_threads(self) -> int:
- """:class:`bool`: Returns ``True`` if a user can create and participate in public threads.
+ def create_public_threads(self) -> int:
+ """:class:`bool`: Returns ``True`` if a user can create public threads.
.. versionadded:: 2.0
"""
return 1 << 35
@flag_value
- def use_private_threads(self) -> int:
- """:class:`bool`: Returns ``True`` if a user can create and participate in private threads.
+ def create_private_threads(self) -> int:
+ """:class:`bool`: Returns ``True`` if a user can create private threads.
.. versionadded:: 2.0
"""
@@ -542,6 +543,14 @@ class Permissions(BaseFlags):
"""
return 1 << 37
+ @flag_value
+ def send_messages_in_threads(self) -> int:
+ """:class:`bool`: Returns ``True`` if a user can send messages in threads.
+
+ .. versionadded:: 2.0
+ """
+ return 1 << 38
+
PO = TypeVar('PO', bound='PermissionOverwrite')
def _augment_from_permissions(cls):
@@ -650,8 +659,9 @@ class PermissionOverwrite:
request_to_speak: Optional[bool]
manage_events: Optional[bool]
manage_threads: Optional[bool]
- use_threads: Optional[bool]
- use_private_threads: Optional[bool]
+ create_public_threads: Optional[bool]
+ create_private_threads: Optional[bool]
+ send_messages_in_threads: Optional[bool]
external_stickers: Optional[bool]
use_external_stickers: Optional[bool]
diff --git a/discord/threads.py b/discord/threads.py
index 6c9a7495..892910d9 100644
--- a/discord/threads.py
+++ b/discord/threads.py
@@ -594,10 +594,8 @@ class Thread(Messageable, Hashable):
Joins this thread.
- You must have :attr:`~Permissions.send_messages` and :attr:`~Permissions.use_threads`
- to join a public thread. If the thread is private then :attr:`~Permissions.send_messages`
- and either :attr:`~Permissions.use_private_threads` or :attr:`~Permissions.manage_messages`
- is required to join the 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
-------