Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 10 additions & 5 deletions discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down