Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app command copies #678

Merged
merged 10 commits into from
Aug 25, 2022
1 change: 1 addition & 0 deletions changelog/678.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make the :func:`.ext.commands.default_member_permissions` decorator always work in cogs.
8 changes: 8 additions & 0 deletions disnake/ext/commands/base_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ def _ensure_assignment_on_copy(self, other: AppCommandT) -> AppCommandT:
# _max_concurrency won't be None at this point
other._max_concurrency = cast(MaxConcurrency, self._max_concurrency).copy()

if self.body._default_member_permissions != other.body._default_member_permissions:
EQUENOS marked this conversation as resolved.
Show resolved Hide resolved
if "default_member_permissions" not in other.__original_kwargs__:
other.body._default_member_permissions = self.body._default_member_permissions
elif self.body._default_member_permissions is not None:
raise ValueError(
"Cannot set `default_member_permissions` in both decorator and slash_command_attrs"
EQUENOS marked this conversation as resolved.
Show resolved Hide resolved
)

try:
other.on_error = self.on_error
except AttributeError:
Expand Down