From 1b3cae553fb61450068f0b138abe54e696e4ca54 Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Sat, 31 May 2025 04:25:22 +0100 Subject: [PATCH 1/5] change default nsfw to false --- discord/commands/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) From d2a9506ab5e68a6d7d66e6f2b772bb8ed4357443 Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Sat, 31 May 2025 04:28:51 +0100 Subject: [PATCH 2/5] cl --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e40955afe..589f724f87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -122,6 +122,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 From 248f2a6badea4281d939811b910a92b7b72155c2 Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Sat, 31 May 2025 04:54:00 +0100 Subject: [PATCH 3/5] localizations --- discord/bot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/discord/bot.py b/discord/bot.py index 0f9b30480c..0a4f07f000 100644 --- a/discord/bot.py +++ b/discord/bot.py @@ -329,8 +329,11 @@ 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 ( + # 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 From 4b7b1c9e06cf1d4e712203537ce05d5fe4d30058 Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Sat, 31 May 2025 04:55:35 +0100 Subject: [PATCH 4/5] := --- discord/bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/bot.py b/discord/bot.py index 0a4f07f000..2a1b994641 100644 --- a/discord/bot.py +++ b/discord/bot.py @@ -328,15 +328,15 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool: ]: # We have a difference return True - elif getattr(cmd, check, None) != match.get(check): + 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 From c2d8d7cf282b4ea793b98744da11136566314126 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 31 May 2025 03:55:59 +0000 Subject: [PATCH 5/5] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/bot.py b/discord/bot.py index 2a1b994641..037e5a947a 100644 --- a/discord/bot.py +++ b/discord/bot.py @@ -328,7 +328,9 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool: ]: # We have a difference return True - elif (attr := getattr(cmd, check, None)) != (found := match.get(check)): + 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