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: