mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
[commands] Reassign app_command attribute on copy
Prior to this change it would re-create the HybridAppCommand on copy which had the consequence of clearing parameter related changes.
This commit is contained in:
parent
1232a1d2fd
commit
52fcaed79b
@ -136,6 +136,12 @@ class HybridAppCommand(discord.app_commands.Command[CogT, P, T]):
|
||||
copy.wrapped = self.wrapped
|
||||
return copy
|
||||
|
||||
def copy(self) -> Self:
|
||||
bindings = {
|
||||
self.binding: self.binding,
|
||||
}
|
||||
return self._copy_with(parent=self.parent, binding=self.binding, bindings=bindings)
|
||||
|
||||
async def _check_can_run(self, interaction: discord.Interaction) -> bool:
|
||||
# Hybrid checks must run like so:
|
||||
# - Bot global check once
|
||||
@ -271,6 +277,10 @@ class HybridCommand(Command[CogT, P, T]):
|
||||
else:
|
||||
ctx.kwargs = await self.app_command._transform_arguments(interaction, interaction.namespace)
|
||||
|
||||
def _ensure_assignment_on_copy(self, other: Self) -> Self:
|
||||
copy = super()._ensure_assignment_on_copy(other)
|
||||
copy.app_command = self.app_command.copy()
|
||||
return copy
|
||||
|
||||
class HybridGroup(Group[CogT, P, T]):
|
||||
r"""A class that is both an application command group and a regular text group.
|
||||
|
Loading…
x
Reference in New Issue
Block a user