Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1484.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :attr:`.Permissions.bypass_slowmode` which allows a user to bypass slowmode. Note that bot users are not impacted by slowmode regardless of this permission.
1 change: 1 addition & 0 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ async def set_permissions(
administrator: bool | None = ...,
attach_files: bool | None = ...,
ban_members: bool | None = ...,
bypass_slowmode: bool | None = ...,
change_nickname: bool | None = ...,
connect: bool | None = ...,
create_events: bool | None = ...,
Expand Down
1 change: 1 addition & 0 deletions disnake/ext/commands/base_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ def default_member_permissions(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down
4 changes: 4 additions & 0 deletions disnake/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,7 @@ def has_permissions(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down Expand Up @@ -2146,6 +2147,7 @@ def bot_has_permissions(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down Expand Up @@ -2251,6 +2253,7 @@ def has_guild_permissions(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down Expand Up @@ -2353,6 +2356,7 @@ def bot_has_guild_permissions(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down
24 changes: 23 additions & 1 deletion disnake/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def __init__(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down Expand Up @@ -405,9 +406,13 @@ def text(cls) -> Self:

.. versionchanged:: 2.10
Moved :attr:`use_application_commands` permission to :attr:`apps`.
Added :attr:`send_polls` permission.

.. versionchanged:: 2.11
Added :attr:`pin_messages` permission.

.. versionchanged:: |vnext|
Added :attr:`bypass_slowmode` permission.
"""
return cls(
send_messages=True,
Expand All @@ -427,6 +432,7 @@ def text(cls) -> Self:
send_voice_messages=True,
pin_messages=True,
send_polls=True,
bypass_slowmode=True,
)

@classmethod
Expand Down Expand Up @@ -536,11 +542,12 @@ def private_channel(cls) -> Self:
This is equivalent to :meth:`Permissions.text` with :attr:`~Permissions.view_channel` with the following set to False:

- :attr:`~Permissions.send_tts_messages`: You cannot send TTS messages in a DM.
- :attr:`~Permissions.manage_messages`: You cannot delete others messages in a DM.
- :attr:`~Permissions.manage_messages`: You cannot delete others' messages in a DM.
- :attr:`~Permissions.manage_threads`: You cannot manage threads in a DM.
- :attr:`~Permissions.send_messages_in_threads`: You cannot make threads in a DM.
- :attr:`~Permissions.create_public_threads`: You cannot make public threads in a DM.
- :attr:`~Permissions.create_private_threads`: You cannot make private threads in a DM.
- :attr:`~Permissions.bypass_slowmode`: You cannot enable slowmode in a DM.

.. versionadded:: 2.4
"""
Expand All @@ -552,6 +559,7 @@ def private_channel(cls) -> Self:
base.send_messages_in_threads = False
base.create_public_threads = False
base.create_private_threads = False
base.bypass_slowmode = False
return base

@overload
Expand All @@ -563,6 +571,7 @@ def update(
administrator: bool = ...,
attach_files: bool = ...,
ban_members: bool = ...,
bypass_slowmode: bool = ...,
change_nickname: bool = ...,
connect: bool = ...,
create_events: bool = ...,
Expand Down Expand Up @@ -1085,6 +1094,16 @@ def pin_messages(self) -> int:
"""
return 1 << 51

@flag_value
def bypass_slowmode(self) -> int:
""":class:`bool`: Returns ``True`` if a user can bypass slowmode restrictions.

Bots are unaffected by slowmode regardless of this permission.

.. versionadded:: |vnext|
"""
return 1 << 52


def _augment_from_permissions(cls):
cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
Expand Down Expand Up @@ -1155,6 +1174,7 @@ class PermissionOverwrite:
administrator: bool | None
attach_files: bool | None
ban_members: bool | None
bypass_slowmode: bool | None
change_nickname: bool | None
connect: bool | None
create_events: bool | None
Expand Down Expand Up @@ -1224,6 +1244,7 @@ def __init__(
administrator: bool | None = ...,
attach_files: bool | None = ...,
ban_members: bool | None = ...,
bypass_slowmode: bool | None = ...,
change_nickname: bool | None = ...,
connect: bool | None = ...,
create_events: bool | None = ...,
Expand Down Expand Up @@ -1360,6 +1381,7 @@ def update(
administrator: bool | None = ...,
attach_files: bool | None = ...,
ban_members: bool | None = ...,
bypass_slowmode: bool | None = ...,
change_nickname: bool | None = ...,
connect: bool | None = ...,
create_events: bool | None = ...,
Expand Down