Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
20 changes: 20 additions & 0 deletions 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 @@ -563,6 +569,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 +1092,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 +1172,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 +1242,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 +1379,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