From b4431f6c27fb692436410920dae7e65d7cb3bd1c Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:10:58 +0200 Subject: [PATCH] Update ids on delete & edit too --- discord/app_commands/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/discord/app_commands/models.py b/discord/app_commands/models.py index e8a96784b..b7d7f6b85 100644 --- a/discord/app_commands/models.py +++ b/discord/app_commands/models.py @@ -309,6 +309,10 @@ class AppCommand(Hashable): self.id, ) + tree = self._state._command_tree + if tree: + tree._command_ids.get(self.guild_id, {}).pop(self.name, None) + async def edit( self, *, @@ -392,6 +396,11 @@ class AppCommand(Hashable): self.id, payload, ) + + tree = self._state._command_tree + if tree: + tree._update_command_ids(data) + return AppCommand(data=data, state=state) async def fetch_permissions(self, guild: Snowflake) -> GuildAppCommandPermissions: