mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-13 09:19:48 +00:00
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
This commit is contained in:
parent
d2ea33e5e9
commit
4aafa39e8c
@ -684,15 +684,8 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
|
|
||||||
Creates a thread in this text channel.
|
Creates a thread in this text channel.
|
||||||
|
|
||||||
If no starter message is passed with the ``message`` parameter then
|
To create a public thread, you must have :attr:`~discord.Permissions.create_public_threads`.
|
||||||
you must have :attr:`~discord.Permissions.send_messages` and
|
For a private thread, :attr:`~discord.Permissions.create_private_threads` is needed instead.
|
||||||
: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.
|
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
|
@ -1496,8 +1496,8 @@ class Message(Hashable):
|
|||||||
|
|
||||||
Creates a public thread from this message.
|
Creates a public thread from this message.
|
||||||
|
|
||||||
You must have :attr:`~discord.Permissions.send_messages` and
|
You must have :attr:`~discord.Permissions.create_public_threads` in order to
|
||||||
:attr:`~discord.Permissions.use_threads` in order to create a thread.
|
create a public thread from a message.
|
||||||
|
|
||||||
The channel this message belongs in must be a :class:`TextChannel`.
|
The channel this message belongs in must be a :class:`TextChannel`.
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class Permissions(BaseFlags):
|
|||||||
"""A factory method that creates a :class:`Permissions` with all
|
"""A factory method that creates a :class:`Permissions` with all
|
||||||
permissions set to ``True``.
|
permissions set to ``True``.
|
||||||
"""
|
"""
|
||||||
return cls(0b11111111111111111111111111111111111111)
|
return cls(0b111111111111111111111111111111111111111)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def all_channel(cls: Type[P]) -> P:
|
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.
|
Added :attr:`stream`, :attr:`priority_speaker` and :attr:`use_slash_commands` permissions.
|
||||||
|
|
||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
Added :attr:`use_threads`, :attr:`use_private_threads`, :attr:`manage_threads`,
|
Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
|
||||||
:attr:`use_external_stickers` and :attr:`request_to_speak` permissions.
|
:attr:`use_external_stickers`, :attr:`send_messages_in_threads` and
|
||||||
|
:attr:`request_to_speak` permissions.
|
||||||
"""
|
"""
|
||||||
return cls(0b11110110110011111101111111111101010001)
|
return cls(0b111101101100111111011111111111010100011)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def general(cls: Type[P]) -> P:
|
def general(cls: Type[P]) -> P:
|
||||||
@ -206,10 +207,10 @@ class Permissions(BaseFlags):
|
|||||||
Added :attr:`use_slash_commands` permission.
|
Added :attr:`use_slash_commands` permission.
|
||||||
|
|
||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
Added :attr:`use_threads`, :attr:`use_private_threads`, :attr:`manage_threads`
|
Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
|
||||||
and :attr:`use_external_stickers` permissions.
|
:attr:`send_messages_in_threads` and :attr:`use_external_stickers` permissions.
|
||||||
"""
|
"""
|
||||||
return cls(0b11110010000000000001111111100001000000)
|
return cls(0b111110010000000000001111111100001000000)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def voice(cls: Type[P]) -> P:
|
def voice(cls: Type[P]) -> P:
|
||||||
@ -511,16 +512,16 @@ class Permissions(BaseFlags):
|
|||||||
return 1 << 34
|
return 1 << 34
|
||||||
|
|
||||||
@flag_value
|
@flag_value
|
||||||
def use_threads(self) -> int:
|
def create_public_threads(self) -> int:
|
||||||
""":class:`bool`: Returns ``True`` if a user can create and participate in public threads.
|
""":class:`bool`: Returns ``True`` if a user can create public threads.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
"""
|
"""
|
||||||
return 1 << 35
|
return 1 << 35
|
||||||
|
|
||||||
@flag_value
|
@flag_value
|
||||||
def use_private_threads(self) -> int:
|
def create_private_threads(self) -> int:
|
||||||
""":class:`bool`: Returns ``True`` if a user can create and participate in private threads.
|
""":class:`bool`: Returns ``True`` if a user can create private threads.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
"""
|
"""
|
||||||
@ -542,6 +543,14 @@ class Permissions(BaseFlags):
|
|||||||
"""
|
"""
|
||||||
return 1 << 37
|
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')
|
PO = TypeVar('PO', bound='PermissionOverwrite')
|
||||||
|
|
||||||
def _augment_from_permissions(cls):
|
def _augment_from_permissions(cls):
|
||||||
@ -650,8 +659,9 @@ class PermissionOverwrite:
|
|||||||
request_to_speak: Optional[bool]
|
request_to_speak: Optional[bool]
|
||||||
manage_events: Optional[bool]
|
manage_events: Optional[bool]
|
||||||
manage_threads: Optional[bool]
|
manage_threads: Optional[bool]
|
||||||
use_threads: Optional[bool]
|
create_public_threads: Optional[bool]
|
||||||
use_private_threads: Optional[bool]
|
create_private_threads: Optional[bool]
|
||||||
|
send_messages_in_threads: Optional[bool]
|
||||||
external_stickers: Optional[bool]
|
external_stickers: Optional[bool]
|
||||||
use_external_stickers: Optional[bool]
|
use_external_stickers: Optional[bool]
|
||||||
|
|
||||||
|
@ -594,10 +594,8 @@ class Thread(Messageable, Hashable):
|
|||||||
|
|
||||||
Joins this thread.
|
Joins this thread.
|
||||||
|
|
||||||
You must have :attr:`~Permissions.send_messages` and :attr:`~Permissions.use_threads`
|
You must have :attr:`~Permissions.send_messages_in_threads` to join a thread.
|
||||||
to join a public thread. If the thread is private then :attr:`~Permissions.send_messages`
|
If the thread is private, :attr:`~Permissions.manage_threads` is also needed.
|
||||||
and either :attr:`~Permissions.use_private_threads` or :attr:`~Permissions.manage_messages`
|
|
||||||
is required to join the thread.
|
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user