Skip to content

Commit 7c5c6f8

Browse files
committed
Merge branch 'master' into refactor-utils
2 parents 4a2753c + 160f5f4 commit 7c5c6f8

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ These changes are available on the `master` branch, but have not yet been releas
128128
changes. ([#2671](https://github.com/Pycord-Development/pycord/pull/2671))
129129
- `Entitlement.ends_at` can now be `None`.
130130
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
131+
- Changed the default value of `ApplicationCommand.nsfw` to `False`.
132+
([#2797](https://github.com/Pycord-Development/pycord/pull/2797))
131133

132134
### Deprecated
133135

discord/bot.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,12 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool:
307307
]:
308308
# We have a difference
309309
return True
310-
elif getattr(cmd, check, None) != match.get(check):
311-
# We have a difference
312-
if check == "default_permission" and getattr(cmd, check) is True and match.get(check) is None:
310+
elif (attr := getattr(cmd, check, None)) != (found := match.get(check)):
311+
# We might have a difference
312+
if "localizations" in check and bool(attr) == bool(found):
313+
# unlike other attrs, localizations are MISSING by default
314+
continue
315+
elif check == "default_permission" and attr is True and found is None:
313316
# This is a special case
314317
# TODO: Remove for perms v2
315318
continue

discord/commands/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def __init__(self, func: Callable, **kwargs) -> None:
227227
"__default_member_permissions__",
228228
kwargs.get("default_member_permissions", None),
229229
)
230-
self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", None))
230+
self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", False))
231231

232232
integration_types = getattr(func, "__integration_types__", kwargs.get("integration_types", None))
233233
contexts = getattr(func, "__contexts__", kwargs.get("contexts", None))
@@ -1183,7 +1183,7 @@ def __init__(
11831183

11841184
# Permissions
11851185
self.default_member_permissions: Permissions | None = kwargs.get("default_member_permissions", None)
1186-
self.nsfw: bool | None = kwargs.get("nsfw", None)
1186+
self.nsfw: bool | None = kwargs.get("nsfw", False)
11871187

11881188
integration_types = kwargs.get("integration_types", None)
11891189
contexts = kwargs.get("contexts", None)

discord/role.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ async def edit(
444444
reason: str | None | utils.Undefined = MISSING,
445445
icon: bytes | None | utils.Undefined = MISSING,
446446
unicode_emoji: str | None | utils.Undefined = MISSING,
447-
) -> Role | None:
447+
) -> Role:
448448
"""|coro|
449449
450450
Edits the role.

0 commit comments

Comments
 (0)