Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(permissions): add SET_VOICE_CHANNEL_STATUS permission #1101

Closed
wants to merge 19 commits into from
Closed
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/1090.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :attr:`Permissions.use_clyde_ai`.
1 change: 1 addition & 0 deletions changelog/1101.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :attr:`Permissions.set_voice_channel_status`.
3 changes: 3 additions & 0 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ def _apply_implict_permissions(self, base: Permissions) -> None:
base.mention_everyone = False
base.embed_links = False
base.attach_files = False
base.use_clyde_ai = False

# if you can't view a channel then you have no permissions there
if not base.view_channel:
Expand Down Expand Up @@ -886,10 +887,12 @@ async def set_permissions(
send_messages_in_threads: Optional[bool] = ...,
send_tts_messages: Optional[bool] = ...,
send_voice_messages: Optional[bool] = ...,
set_voice_channel_status: Optional[bool] = ...,
speak: Optional[bool] = ...,
start_embedded_activities: Optional[bool] = ...,
stream: Optional[bool] = ...,
use_application_commands: Optional[bool] = ...,
use_clyde_ai: Optional[bool] = ...,
use_embedded_activities: Optional[bool] = ...,
use_external_emojis: Optional[bool] = ...,
use_external_sounds: Optional[bool] = ...,
Expand Down
2 changes: 2 additions & 0 deletions disnake/ext/commands/base_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,10 +669,12 @@ def default_member_permissions(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down
8 changes: 8 additions & 0 deletions disnake/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2045,10 +2045,12 @@ def has_permissions(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down Expand Up @@ -2167,10 +2169,12 @@ def bot_has_permissions(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down Expand Up @@ -2267,10 +2271,12 @@ def has_guild_permissions(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down Expand Up @@ -2364,10 +2370,12 @@ def bot_has_guild_permissions(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down
37 changes: 37 additions & 0 deletions disnake/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,12 @@ def __init__(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down Expand Up @@ -316,6 +318,9 @@ def all_channel(cls) -> Self:

.. versionchanged:: 2.9
Added :attr:`use_soundboard` and :attr:`send_voice_messages` permissions.

.. versionchanged:: 2.10
Added :attr:`use_clyde_ai`, :attr:`set_voice_channel_status` permissions.
"""
instance = cls.all()
instance.update(
Expand Down Expand Up @@ -396,6 +401,9 @@ def text(cls) -> Self:

.. versionchanged:: 2.9
Added :attr:`send_voice_messages` permission.

.. versionchanged:: 2.10
Added :attr:`use_clyde_ai` permission.
"""
return cls(
send_messages=True,
Expand All @@ -414,6 +422,7 @@ def text(cls) -> Self:
send_tts_messages=True,
use_slash_commands=True,
send_voice_messages=True,
use_clyde_ai=True,
)

@classmethod
Expand All @@ -427,6 +436,9 @@ def voice(cls) -> Self:

.. versionchanged:: 2.9
Added :attr:`use_soundboard` and :attr:`use_external_sounds` permissions.

.. versionchanged:: 2.10
Added :attr:`set_voice_channel_status` permission.
"""
return cls(
connect=True,
Expand All @@ -440,6 +452,7 @@ def voice(cls) -> Self:
mute_members=True,
deafen_members=True,
move_members=True,
set_voice_channel_status=True,
)

@classmethod
Expand Down Expand Up @@ -565,10 +578,12 @@ def update(
send_messages_in_threads: bool = ...,
send_tts_messages: bool = ...,
send_voice_messages: bool = ...,
set_voice_channel_status: bool = ...,
speak: bool = ...,
start_embedded_activities: bool = ...,
stream: bool = ...,
use_application_commands: bool = ...,
use_clyde_ai: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
Expand Down Expand Up @@ -994,6 +1009,22 @@ def send_voice_messages(self) -> int:
"""
return 1 << 46

@flag_value
def use_clyde_ai(self) -> int:
""":class:`bool`: Returns ``True`` if a user can interact with the Clyde AI bot.

.. versionadded:: 2.10
"""
return 1 << 47

@flag_value
def set_voice_channel_status(self) -> int:
""":class:`bool`: Returns ``True`` if a user can set a voice channel's status.

.. versionadded:: 2.10
"""
return 1 << 48


def _augment_from_permissions(cls):
cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
Expand Down Expand Up @@ -1099,10 +1130,12 @@ class PermissionOverwrite:
send_messages_in_threads: Optional[bool]
send_tts_messages: Optional[bool]
send_voice_messages: Optional[bool]
set_voice_channel_status: Optional[bool]
speak: Optional[bool]
start_embedded_activities: Optional[bool]
stream: Optional[bool]
use_application_commands: Optional[bool]
use_clyde_ai: Optional[bool]
use_embedded_activities: Optional[bool]
use_external_emojis: Optional[bool]
use_external_sounds: Optional[bool]
Expand Down Expand Up @@ -1163,10 +1196,12 @@ def __init__(
send_messages_in_threads: Optional[bool] = ...,
send_tts_messages: Optional[bool] = ...,
send_voice_messages: Optional[bool] = ...,
set_voice_channel_status: Optional[bool] = ...,
speak: Optional[bool] = ...,
start_embedded_activities: Optional[bool] = ...,
stream: Optional[bool] = ...,
use_application_commands: Optional[bool] = ...,
use_clyde_ai: Optional[bool] = ...,
use_embedded_activities: Optional[bool] = ...,
use_external_emojis: Optional[bool] = ...,
use_external_sounds: Optional[bool] = ...,
Expand Down Expand Up @@ -1294,10 +1329,12 @@ def update(
send_messages_in_threads: Optional[bool] = ...,
send_tts_messages: Optional[bool] = ...,
send_voice_messages: Optional[bool] = ...,
set_voice_channel_status: Optional[bool] = ...,
speak: Optional[bool] = ...,
start_embedded_activities: Optional[bool] = ...,
stream: Optional[bool] = ...,
use_application_commands: Optional[bool] = ...,
use_clyde_ai: Optional[bool] = ...,
use_embedded_activities: Optional[bool] = ...,
use_external_emojis: Optional[bool] = ...,
use_external_sounds: Optional[bool] = ...,
Expand Down
1 change: 1 addition & 0 deletions disnake/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def permissions_for(
base.mention_everyone = False
base.embed_links = False
base.attach_files = False
base.use_clyde_ai = False

# if you can't view a channel then you have no permissions there
if not base.view_channel:
Expand Down
Loading