From 05d0d6b44ccb09e1323965be9e0a740738092cdf Mon Sep 17 00:00:00 2001 From: NyuwBot Date: Mon, 1 Jan 2024 04:43:48 +0100 Subject: [PATCH] fix: ephemeral error messages --- .../ApplicationCommandsExtension.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs b/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs index 78fc16ef17..210fd3beab 100644 --- a/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs +++ b/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs @@ -1158,7 +1158,6 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs break; } case InteractionType.AutoComplete when s_errored: - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Application commands failed to register properly on startup.")).ConfigureAwait(false); throw new InvalidOperationException("Application commands failed to register properly on startup."); case InteractionType.AutoComplete: { @@ -1166,10 +1165,7 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs var groups = GroupCommands.Where(x => x.CommandId == e.Interaction.Data.Id).ToList(); var subgroups = SubGroupCommands.Where(x => x.CommandId == e.Interaction.Data.Id).ToList(); if (methods.Count is 0 && groups.Count is 0 && subgroups.Count is 0) - { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("An autocomplete interaction was created, but no command was registered for it")).ConfigureAwait(false); throw new InvalidOperationException("An autocomplete interaction was created, but no command was registered for it"); - } try { @@ -1361,7 +1357,7 @@ private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCrea { if (s_errored) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Context menus failed to register properly on startup.")).ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Context menus failed to register properly on startup.").AsEphemeral()).ConfigureAwait(false); throw new InvalidOperationException("Context menus failed to register properly on startup."); } @@ -1370,7 +1366,7 @@ private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCrea if (method == null) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("A context menu command was executed, but no command was registered for it.")).ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("A context menu command was executed, but no command was registered for it.").AsEphemeral()).ConfigureAwait(false); throw new InvalidOperationException("A context menu command was executed, but no command was registered for it."); }