From 2b37d57aff06ff5bbe06582a7b1b7c517e1c9eaf Mon Sep 17 00:00:00 2001 From: Dirk Kok Date: Sun, 1 Sep 2024 20:54:27 +0200 Subject: [PATCH] better error response for failing checks. i do not like the implementation, but it works, and a better implementation is unwieldy and unpleasant --- HighlightBot/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HighlightBot/Program.cs b/HighlightBot/Program.cs index 10d968b..7cf39ab 100644 --- a/HighlightBot/Program.cs +++ b/HighlightBot/Program.cs @@ -118,7 +118,7 @@ async Task ReportCommandError(CommandContext e, Exception exception) { return eventArgs.Exception switch { CommandNotFoundException => eventArgs.Context.RespondAsync("Unknown command."), - ChecksFailedException => eventArgs.Context.RespondAsync("Checks failed 🙁"), + ChecksFailedException => eventArgs.Context.RespondAsync("All commands must be used within a server."), ArgumentException { Message: "Could not find a suitable overload for the command." } => eventArgs.Context.RespondAsync("Invalid arguments."), _ => ReportCommandError(eventArgs.Context, eventArgs.Exception), }; @@ -144,7 +144,7 @@ async Task ReportSlashCommandError(InteractionContext e, Exception exception) { Host.Services.GetRequiredService>().LogError(eventArgs.Exception, "Error executing slash command"); return eventArgs.Exception switch { - SlashExecutionChecksFailedException => eventArgs.Context.CreateResponseAsync("Checks failed 🙁"), + SlashExecutionChecksFailedException => eventArgs.Context.CreateResponseAsync("All commands must be used within a server."), ArgumentException { Message: "Could not find a suitable overload for the command." } => eventArgs.Context.CreateResponseAsync("Invalid arguments."), _ => ReportSlashCommandError(eventArgs.Context, eventArgs.Exception), };