Skip to content

Commit 5183081

Browse files
authored
Merge branch 'master' into feat/partial-objs
2 parents 6006042 + 160f5f4 commit 5183081

File tree

6 files changed

+11
-1277
lines changed

6 files changed

+11
-1277
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.

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ docs = [
6666
"typing-extensions==4.13.1",
6767
]
6868
dev = [
69-
"bandit==1.8.3",
7069
"codespell==2.4.1",
7170
"coverage~=7.8",
72-
"flake8==7.1.2",
7371
"mypy~=1.15.0",
7472
"pre-commit==4.2.0",
75-
"pylint~=3.3.6",
7673
"pytest~=8.3.5",
7774
"pytest-asyncio~=0.24.0",
7875
"ruff>=0.11.9",

0 commit comments

Comments
 (0)