mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-03-05 03:02:49 +00:00
Add bypass slowmode permissions
This commit is contained in:
@@ -597,8 +597,7 @@ class AppCommandChannel(Hashable):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between sending messages
|
The number of seconds a member must wait between sending messages
|
||||||
in this channel. A value of ``0`` denotes that it is disabled.
|
in this channel. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~discord.Permissions.manage_channels` or
|
Bots and users with :attr:`~discord.Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~discord.Permissions.manage_messages` bypass slowmode.
|
|
||||||
|
|
||||||
.. versionadded:: 2.6
|
.. versionadded:: 2.6
|
||||||
nsfw: :class:`bool`
|
nsfw: :class:`bool`
|
||||||
@@ -779,8 +778,7 @@ class AppCommandThread(Hashable):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between sending messages
|
The number of seconds a member must wait between sending messages
|
||||||
in this thread. A value of ``0`` denotes that it is disabled.
|
in this thread. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~discord.Permissions.manage_channels` or
|
Bots and users with :attr:`~discord.Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~discord.Permissions.manage_messages` bypass slowmode.
|
|
||||||
|
|
||||||
.. versionadded:: 2.6
|
.. versionadded:: 2.6
|
||||||
message_count: :class:`int`
|
message_count: :class:`int`
|
||||||
|
|||||||
@@ -322,8 +322,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between sending messages
|
The number of seconds a member must wait between sending messages
|
||||||
in this channel. A value of ``0`` denotes that it is disabled.
|
in this channel. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~Permissions.manage_channels` or
|
Bots and users with :attr:`~Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~Permissions.manage_messages` bypass slowmode.
|
|
||||||
nsfw: :class:`bool`
|
nsfw: :class:`bool`
|
||||||
If the channel is marked as "not safe for work" or "age restricted".
|
If the channel is marked as "not safe for work" or "age restricted".
|
||||||
default_auto_archive_duration: :class:`int`
|
default_auto_archive_duration: :class:`int`
|
||||||
@@ -1516,8 +1515,7 @@ class VoiceChannel(VocalGuildChannel):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between sending messages
|
The number of seconds a member must wait between sending messages
|
||||||
in this channel. A value of ``0`` denotes that it is disabled.
|
in this channel. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~Permissions.manage_channels` or
|
Bots and users with :attr:`~Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~Permissions.manage_messages` bypass slowmode.
|
|
||||||
|
|
||||||
.. versionadded:: 2.2
|
.. versionadded:: 2.2
|
||||||
"""
|
"""
|
||||||
@@ -1744,8 +1742,7 @@ class StageChannel(VocalGuildChannel):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between sending messages
|
The number of seconds a member must wait between sending messages
|
||||||
in this channel. A value of ``0`` denotes that it is disabled.
|
in this channel. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~Permissions.manage_channels` or
|
Bots and users with :attr:`~Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~Permissions.manage_messages` bypass slowmode.
|
|
||||||
|
|
||||||
.. versionadded:: 2.2
|
.. versionadded:: 2.2
|
||||||
"""
|
"""
|
||||||
@@ -2409,8 +2406,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between creating threads
|
The number of seconds a member must wait between creating threads
|
||||||
in this forum. A value of ``0`` denotes that it is disabled.
|
in this forum. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~Permissions.manage_channels` or
|
Bots and users with :attr:`~Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~Permissions.manage_messages` bypass slowmode.
|
|
||||||
nsfw: :class:`bool`
|
nsfw: :class:`bool`
|
||||||
If the forum is marked as "not safe for work" or "age restricted".
|
If the forum is marked as "not safe for work" or "age restricted".
|
||||||
default_auto_archive_duration: :class:`int`
|
default_auto_archive_duration: :class:`int`
|
||||||
|
|||||||
@@ -1453,7 +1453,7 @@ class PartialMessage(Hashable):
|
|||||||
|
|
||||||
Pins the message.
|
Pins the message.
|
||||||
|
|
||||||
You must have :attr:`~Permissions.manage_messages` to do
|
You must have :attr:`~Permissions.pin_messages` to do
|
||||||
this in a non-private channel context.
|
this in a non-private channel context.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -1471,7 +1471,7 @@ class PartialMessage(Hashable):
|
|||||||
The message or channel was not found or deleted.
|
The message or channel was not found or deleted.
|
||||||
HTTPException
|
HTTPException
|
||||||
Pinning the message failed, probably due to the channel
|
Pinning the message failed, probably due to the channel
|
||||||
having more than 50 pinned messages.
|
having more than 250 pinned messages.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
await self._state.http.pin_message(self.channel.id, self.id, reason=reason)
|
await self._state.http.pin_message(self.channel.id, self.id, reason=reason)
|
||||||
@@ -1483,7 +1483,7 @@ class PartialMessage(Hashable):
|
|||||||
|
|
||||||
Unpins the message.
|
Unpins the message.
|
||||||
|
|
||||||
You must have :attr:`~Permissions.manage_messages` to do
|
You must have :attr:`~Permissions.pin_messages` to do
|
||||||
this in a non-private channel context.
|
this in a non-private channel context.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ if TYPE_CHECKING:
|
|||||||
create_polls: BoolOrNoneT
|
create_polls: BoolOrNoneT
|
||||||
use_external_apps: BoolOrNoneT
|
use_external_apps: BoolOrNoneT
|
||||||
pin_messages: BoolOrNoneT
|
pin_messages: BoolOrNoneT
|
||||||
|
bypass_slowmode: BoolOrNoneT
|
||||||
|
|
||||||
class _PermissionsKwargs(_BasePermissionsKwargs[bool]): ...
|
class _PermissionsKwargs(_BasePermissionsKwargs[bool]): ...
|
||||||
|
|
||||||
@@ -253,7 +254,7 @@ class Permissions(BaseFlags):
|
|||||||
permissions set to ``True``.
|
permissions set to ``True``.
|
||||||
"""
|
"""
|
||||||
# Some of these are 0 because we don't want to set unnecessary bits
|
# Some of these are 0 because we don't want to set unnecessary bits
|
||||||
return cls(0b0000_0000_0000_1111_0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111)
|
return cls(0b0000_0000_0001_1111_0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _timeout_mask(cls) -> int:
|
def _timeout_mask(cls) -> int:
|
||||||
@@ -273,6 +274,7 @@ class Permissions(BaseFlags):
|
|||||||
base.create_public_threads = False
|
base.create_public_threads = False
|
||||||
base.manage_threads = False
|
base.manage_threads = False
|
||||||
base.send_messages_in_threads = False
|
base.send_messages_in_threads = False
|
||||||
|
base.bypass_slowmode = False
|
||||||
return base
|
return base
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -326,8 +328,11 @@ class Permissions(BaseFlags):
|
|||||||
.. versionchanged:: 2.4
|
.. versionchanged:: 2.4
|
||||||
Added :attr:`send_polls`, :attr:`send_voice_messages`, attr:`use_external_sounds`,
|
Added :attr:`send_polls`, :attr:`send_voice_messages`, attr:`use_external_sounds`,
|
||||||
:attr:`use_embedded_activities`, and :attr:`use_external_apps` permissions.
|
:attr:`use_embedded_activities`, and :attr:`use_external_apps` permissions.
|
||||||
|
|
||||||
|
.. versionchanged:: 2.7
|
||||||
|
Added :attr:`pin_messages` and :attr:`bypass_slowmode` permissions.
|
||||||
"""
|
"""
|
||||||
return cls(0b0000_0000_0000_1110_0110_0100_1111_1101_1011_0011_1111_0111_1111_1111_0101_0001)
|
return cls(0b0000_0000_0001_1110_0110_0100_1111_1101_1011_0011_1111_0111_1111_1111_0101_0001)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def general(cls) -> Self:
|
def general(cls) -> Self:
|
||||||
@@ -377,9 +382,9 @@ class Permissions(BaseFlags):
|
|||||||
Added :attr:`send_polls` and :attr:`use_external_apps` permissions.
|
Added :attr:`send_polls` and :attr:`use_external_apps` permissions.
|
||||||
|
|
||||||
.. versionchanged:: 2.7
|
.. versionchanged:: 2.7
|
||||||
Added :attr:`pin_messages` permission.
|
Added :attr:`pin_messages` and :attr:`bypass_slowmode` permissions.
|
||||||
"""
|
"""
|
||||||
return cls(0b0000_0000_0000_1110_0100_0000_0111_1100_1000_0000_0000_0111_1111_1000_0100_0000)
|
return cls(0b0000_0000_0001_1110_0100_0000_0111_1100_1000_0000_0000_0111_1111_1000_0100_0000)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def voice(cls) -> Self:
|
def voice(cls) -> Self:
|
||||||
@@ -577,7 +582,7 @@ class Permissions(BaseFlags):
|
|||||||
|
|
||||||
@flag_value
|
@flag_value
|
||||||
def manage_messages(self) -> int:
|
def manage_messages(self) -> int:
|
||||||
""":class:`bool`: Returns ``True`` if a user can delete messages or bypass slowmode in a text channel.
|
""":class:`bool`: Returns ``True`` if a user can delete messages in a text channel.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -884,6 +889,14 @@ class Permissions(BaseFlags):
|
|||||||
"""
|
"""
|
||||||
return 1 << 51
|
return 1 << 51
|
||||||
|
|
||||||
|
@flag_value
|
||||||
|
def bypass_slowmode(self) -> int:
|
||||||
|
""":class:`bool`: Returns ``True`` if a user can bypass slowmode.
|
||||||
|
|
||||||
|
.. versionadded:: 2.7
|
||||||
|
"""
|
||||||
|
return 1 << 52
|
||||||
|
|
||||||
|
|
||||||
def _augment_from_permissions(cls):
|
def _augment_from_permissions(cls):
|
||||||
cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
|
cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
|
||||||
@@ -1009,6 +1022,7 @@ class PermissionOverwrite:
|
|||||||
create_polls: Optional[bool]
|
create_polls: Optional[bool]
|
||||||
use_external_apps: Optional[bool]
|
use_external_apps: Optional[bool]
|
||||||
pin_messages: Optional[bool]
|
pin_messages: Optional[bool]
|
||||||
|
bypass_slowmode: Optional[bool]
|
||||||
|
|
||||||
def __init__(self, **kwargs: Unpack[_PermissionOverwriteKwargs]) -> None:
|
def __init__(self, **kwargs: Unpack[_PermissionOverwriteKwargs]) -> None:
|
||||||
self._values: Dict[str, Optional[bool]] = {}
|
self._values: Dict[str, Optional[bool]] = {}
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ class Thread(Messageable, Hashable):
|
|||||||
slowmode_delay: :class:`int`
|
slowmode_delay: :class:`int`
|
||||||
The number of seconds a member must wait between sending messages
|
The number of seconds a member must wait between sending messages
|
||||||
in this thread. A value of ``0`` denotes that it is disabled.
|
in this thread. A value of ``0`` denotes that it is disabled.
|
||||||
Bots and users with :attr:`~Permissions.manage_channels` or
|
Bots and users with :attr:`~Permissions.bypass_slowmode` bypass slowmode.
|
||||||
:attr:`~Permissions.manage_messages` bypass slowmode.
|
|
||||||
message_count: :class:`int`
|
message_count: :class:`int`
|
||||||
An approximate number of messages in this thread.
|
An approximate number of messages in this thread.
|
||||||
member_count: :class:`int`
|
member_count: :class:`int`
|
||||||
|
|||||||
Reference in New Issue
Block a user