From 3b7223925e09ee503bf89211c49eca7f8837cb92 Mon Sep 17 00:00:00 2001 From: Gradyn Wursten Date: Tue, 20 Dec 2022 10:59:41 -0700 Subject: [PATCH] fix RemoveModulesFromGuildAsync --- src/Discord.Net.Interactions/InteractionService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Interactions/InteractionService.cs b/src/Discord.Net.Interactions/InteractionService.cs index 172f2c839..df4c27aea 100644 --- a/src/Discord.Net.Interactions/InteractionService.cs +++ b/src/Discord.Net.Interactions/InteractionService.cs @@ -697,9 +697,9 @@ namespace Discord.Interactions EnsureClientReady(); var exclude = modules.SelectMany(x => x.ToApplicationCommandProps(true)).ToList(); - var existing = (await RestClient.GetGuildApplicationCommands(guildId).ConfigureAwait(false)).Select(x => x.ToApplicationCommandProps()); + var existing = await RestClient.GetGuildApplicationCommands(guildId).ConfigureAwait(false); - var props = existing.Except(exclude); + var props = existing.Where(x => !exclude.Any(y => y.Name.IsSpecified && x.Name == y.Name.Value)).Select(x => x.ToApplicationCommandProps()); return await RestClient.BulkOverwriteGuildCommands(props.ToArray(), guildId).ConfigureAwait(false); }