diff --git a/changelog/1211.feature.rst b/changelog/1211.feature.rst new file mode 100644 index 0000000000..e12e47f055 --- /dev/null +++ b/changelog/1211.feature.rst @@ -0,0 +1 @@ +Add :attr:`Permissions.use_external_apps`, and a new :attr:`Permissions.apps` category to match the Discord client UI. diff --git a/disnake/abc.py b/disnake/abc.py index c0a5211698..a3c78f8644 100644 --- a/disnake/abc.py +++ b/disnake/abc.py @@ -894,6 +894,7 @@ async def set_permissions( stream: Optional[bool] = ..., use_application_commands: Optional[bool] = ..., use_embedded_activities: Optional[bool] = ..., + use_external_apps: Optional[bool] = ..., use_external_emojis: Optional[bool] = ..., use_external_sounds: Optional[bool] = ..., use_external_stickers: Optional[bool] = ..., diff --git a/disnake/ext/commands/base_core.py b/disnake/ext/commands/base_core.py index ef46210495..8f99381110 100644 --- a/disnake/ext/commands/base_core.py +++ b/disnake/ext/commands/base_core.py @@ -678,6 +678,7 @@ def default_member_permissions( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., diff --git a/disnake/ext/commands/core.py b/disnake/ext/commands/core.py index b9d49ab269..ffa74aaede 100644 --- a/disnake/ext/commands/core.py +++ b/disnake/ext/commands/core.py @@ -2039,6 +2039,7 @@ def has_permissions( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., @@ -2163,6 +2164,7 @@ def bot_has_permissions( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., @@ -2265,6 +2267,7 @@ def has_guild_permissions( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., @@ -2364,6 +2367,7 @@ def bot_has_guild_permissions( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., diff --git a/disnake/permissions.py b/disnake/permissions.py index 4760f51bcf..cf19761ae4 100644 --- a/disnake/permissions.py +++ b/disnake/permissions.py @@ -204,6 +204,7 @@ def __init__( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., @@ -407,6 +408,9 @@ def text(cls) -> Self: .. versionchanged:: 2.9 Added :attr:`send_voice_messages` permission. + + .. versionchanged:: 2.10 + Moved :attr:`use_application_commands` permission to :attr:`apps`. """ return cls( send_messages=True, @@ -423,7 +427,6 @@ def text(cls) -> Self: manage_threads=True, read_message_history=True, send_tts_messages=True, - use_slash_commands=True, send_voice_messages=True, ) @@ -438,12 +441,14 @@ def voice(cls) -> Self: .. versionchanged:: 2.9 Added :attr:`use_soundboard` and :attr:`use_external_sounds` permissions. + + .. versionchanged:: 2.10 + Moved :attr:`use_embedded_activities` permission to :attr:`apps`. """ return cls( connect=True, speak=True, stream=True, - use_embedded_activities=True, use_soundboard=True, use_external_sounds=True, use_voice_activation=True, @@ -479,6 +484,20 @@ def stage_moderator(cls) -> Self: move_members=True, ) + @classmethod + @cached_creation + def apps(cls) -> Self: + """A factory method that creates a :class:`Permissions` with all + "Apps" permissions from the official Discord UI set to ``True``. + + .. versionadded:: 2.10 + """ + return cls( + use_application_commands=True, + use_embedded_activities=True, + use_external_apps=True, + ) + @classmethod @cached_creation def events(cls) -> Self: @@ -587,6 +606,7 @@ def update( stream: bool = ..., use_application_commands: bool = ..., use_embedded_activities: bool = ..., + use_external_apps: bool = ..., use_external_emojis: bool = ..., use_external_sounds: bool = ..., use_external_stickers: bool = ..., @@ -1038,6 +1058,18 @@ def send_voice_messages(self) -> int: """ return 1 << 46 + @flag_value + def use_external_apps(self) -> int: + """:class:`bool`: Returns ``True`` if a user's apps can send public responses. + + If disabled, users can still use their user-installed applications, but the responses + will be forced ephemeral (i.e. only visible to them). + Only applies to user-installed apps that are not also installed to the guild. + + .. versionadded:: 2.10 + """ + return 1 << 50 + def _augment_from_permissions(cls): cls.VALID_NAMES = set(Permissions.VALID_FLAGS) @@ -1150,6 +1182,7 @@ class PermissionOverwrite: stream: Optional[bool] use_application_commands: Optional[bool] use_embedded_activities: Optional[bool] + use_external_apps: Optional[bool] use_external_emojis: Optional[bool] use_external_sounds: Optional[bool] use_external_stickers: Optional[bool] @@ -1216,6 +1249,7 @@ def __init__( stream: Optional[bool] = ..., use_application_commands: Optional[bool] = ..., use_embedded_activities: Optional[bool] = ..., + use_external_apps: Optional[bool] = ..., use_external_emojis: Optional[bool] = ..., use_external_sounds: Optional[bool] = ..., use_external_stickers: Optional[bool] = ..., @@ -1349,6 +1383,7 @@ def update( stream: Optional[bool] = ..., use_application_commands: Optional[bool] = ..., use_embedded_activities: Optional[bool] = ..., + use_external_apps: Optional[bool] = ..., use_external_emojis: Optional[bool] = ..., use_external_sounds: Optional[bool] = ..., use_external_stickers: Optional[bool] = ...,