diff --git a/CHANGELOG.md b/CHANGELOG.md index 46d996a6d2..d1ba1cf88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -128,6 +128,8 @@ These changes are available on the `master` branch, but have not yet been releas changes. ([#2671](https://github.com/Pycord-Development/pycord/pull/2671)) - `Entitlement.ends_at` can now be `None`. ([#2564](https://github.com/Pycord-Development/pycord/pull/2564)) +- Changed the default value of `ApplicationCommand.nsfw` to `False`. + ([#2797](https://github.com/Pycord-Development/pycord/pull/2797)) ### Deprecated diff --git a/discord/bot.py b/discord/bot.py index 0f9b30480c..037e5a947a 100644 --- a/discord/bot.py +++ b/discord/bot.py @@ -328,12 +328,17 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool: ]: # We have a difference return True - elif getattr(cmd, check, None) != match.get(check): - # We have a difference - if ( + elif (attr := getattr(cmd, check, None)) != ( + found := match.get(check) + ): + # We might have a difference + if "localizations" in check and bool(attr) == bool(found): + # unlike other attrs, localizations are MISSING by default + continue + elif ( check == "default_permission" - and getattr(cmd, check) is True - and match.get(check) is None + and attr is True + and found is None ): # This is a special case # TODO: Remove for perms v2 diff --git a/discord/commands/core.py b/discord/commands/core.py index bee43341fd..06996bcaa1 100644 --- a/discord/commands/core.py +++ b/discord/commands/core.py @@ -233,7 +233,7 @@ def __init__(self, func: Callable, **kwargs) -> None: "__default_member_permissions__", kwargs.get("default_member_permissions", None), ) - self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", None)) + self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", False)) integration_types = getattr( func, "__integration_types__", kwargs.get("integration_types", None) @@ -1255,7 +1255,7 @@ def __init__( self.default_member_permissions: Permissions | None = kwargs.get( "default_member_permissions", None ) - self.nsfw: bool | None = kwargs.get("nsfw", None) + self.nsfw: bool | None = kwargs.get("nsfw", False) integration_types = kwargs.get("integration_types", None) contexts = kwargs.get("contexts", None)