Skip to content

Commit

Permalink
feat(permissions): add use_external_sounds (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
onerandomusername authored May 22, 2023
1 parent 53095a6 commit 6d82746
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/989.feature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Add new permission fields.
- :attr:`Permissions.manage_guild_expressions` (which :attr:`~Permissions.manage_emojis` and :attr:`~Permissions.manage_emojis_and_stickers` are now aliased to)
- :attr:`Permissions.view_creator_monetization_analytics`
- :attr:`Permissions.use_soundboard`
- :attr:`Permissions.use_external_sounds`
5 changes: 5 additions & 0 deletions changelog/997.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Add new permission fields.
- :attr:`Permissions.manage_guild_expressions` (which :attr:`~Permissions.manage_emojis` and :attr:`~Permissions.manage_emojis_and_stickers` are now aliased to)
- :attr:`Permissions.view_creator_monetization_analytics`
- :attr:`Permissions.use_soundboard`
- :attr:`Permissions.use_external_sounds`
1 change: 1 addition & 0 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ async def set_permissions(
use_application_commands: Optional[bool] = ...,
use_embedded_activities: Optional[bool] = ...,
use_external_emojis: Optional[bool] = ...,
use_external_sounds: Optional[bool] = ...,
use_external_stickers: Optional[bool] = ...,
use_slash_commands: Optional[bool] = ...,
use_soundboard: Optional[bool] = ...,
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 @@ -674,6 +674,7 @@ def default_member_permissions(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: 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 @@ -2050,6 +2050,7 @@ def has_permissions(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: bool = ...,
Expand Down Expand Up @@ -2170,6 +2171,7 @@ def bot_has_permissions(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: bool = ...,
Expand Down Expand Up @@ -2268,6 +2270,7 @@ def has_guild_permissions(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: bool = ...,
Expand Down Expand Up @@ -2363,6 +2366,7 @@ def bot_has_guild_permissions(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: bool = ...,
Expand Down
16 changes: 15 additions & 1 deletion disnake/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def __init__(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: bool = ...,
Expand Down Expand Up @@ -420,14 +421,15 @@ def voice(cls) -> Self:
Added :attr:`use_embedded_activities` permission.
.. versionchanged:: 2.9
Added :attr:`use_soundboard` permission.
Added :attr:`use_soundboard` and :attr:`use_external_sounds` permissions.
"""
return cls(
connect=True,
speak=True,
stream=True,
use_embedded_activities=True,
use_soundboard=True,
use_external_sounds=True,
use_voice_activation=True,
priority_speaker=True,
mute_members=True,
Expand Down Expand Up @@ -563,6 +565,7 @@ def update(
use_application_commands: bool = ...,
use_embedded_activities: bool = ...,
use_external_emojis: bool = ...,
use_external_sounds: bool = ...,
use_external_stickers: bool = ...,
use_slash_commands: bool = ...,
use_soundboard: bool = ...,
Expand Down Expand Up @@ -969,6 +972,14 @@ def use_soundboard(self) -> int:
"""
return 1 << 42

@flag_value
def use_external_sounds(self) -> int:
""":class:`bool`: Returns ``True`` if a user can use custom soundboard sounds from other guilds.
.. versionadded:: 2.9
"""
return 1 << 45


def _augment_from_permissions(cls):
cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
Expand Down Expand Up @@ -1079,6 +1090,7 @@ class PermissionOverwrite:
use_application_commands: Optional[bool]
use_embedded_activities: Optional[bool]
use_external_emojis: Optional[bool]
use_external_sounds: Optional[bool]
use_external_stickers: Optional[bool]
use_slash_commands: Optional[bool]
use_soundboard: Optional[bool]
Expand Down Expand Up @@ -1141,6 +1153,7 @@ def __init__(
use_application_commands: Optional[bool] = ...,
use_embedded_activities: Optional[bool] = ...,
use_external_emojis: Optional[bool] = ...,
use_external_sounds: Optional[bool] = ...,
use_external_stickers: Optional[bool] = ...,
use_slash_commands: Optional[bool] = ...,
use_soundboard: Optional[bool] = ...,
Expand Down Expand Up @@ -1270,6 +1283,7 @@ def update(
use_application_commands: Optional[bool] = ...,
use_embedded_activities: Optional[bool] = ...,
use_external_emojis: Optional[bool] = ...,
use_external_sounds: Optional[bool] = ...,
use_external_stickers: Optional[bool] = ...,
use_slash_commands: Optional[bool] = ...,
use_soundboard: Optional[bool] = ...,
Expand Down

0 comments on commit 6d82746

Please sign in to comment.