Skip to content

Commit 5e605a4

Browse files
Paillat-devLumabotsNeloBlivionpre-commit-ci[bot]
authored
chore: Merge upstream (#34)
* fix: Role Edit TypeHint (Pycord-Development#2795) Signed-off-by: Lumouille <[email protected]> * fix: command syncing edge cases (Pycord-Development#2797) * change default nsfw to false * cl * localizations * := * style(pre-commit): auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Format code --------- Signed-off-by: Lumouille <[email protected]> Co-authored-by: Lumouille <[email protected]> Co-authored-by: UK <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 109ca46 commit 5e605a4

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
@@ -226,7 +226,7 @@ def __init__(self, func: Callable, **kwargs) -> None:
226226
"__default_member_permissions__",
227227
kwargs.get("default_member_permissions", None),
228228
)
229-
self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", None))
229+
self.nsfw: bool | None = getattr(func, "__nsfw__", kwargs.get("nsfw", False))
230230

231231
integration_types = getattr(func, "__integration_types__", kwargs.get("integration_types", None))
232232
contexts = getattr(func, "__contexts__", kwargs.get("contexts", None))
@@ -1182,7 +1182,7 @@ def __init__(
11821182

11831183
# Permissions
11841184
self.default_member_permissions: Permissions | None = kwargs.get("default_member_permissions", None)
1185-
self.nsfw: bool | None = kwargs.get("nsfw", None)
1185+
self.nsfw: bool | None = kwargs.get("nsfw", False)
11861186

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

discord/role.py

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

0 commit comments

Comments
 (0)