From 11ac7418c6c40e8b2da2ba67bf892103eda20d00 Mon Sep 17 00:00:00 2001 From: Noi Date: Sat, 22 Oct 2022 17:39:11 -0700 Subject: [PATCH] Fix unexpected error message on nonexistent user --- Modules/ModCommands/Commands/NoteWarn.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/ModCommands/Commands/NoteWarn.cs b/Modules/ModCommands/Commands/NoteWarn.cs index 4b820f1..e809a94 100644 --- a/Modules/ModCommands/Commands/NoteWarn.cs +++ b/Modules/ModCommands/Commands/NoteWarn.cs @@ -65,10 +65,10 @@ abstract class NoteWarn : CommandConfig { var targetUser = g.GetUser(targetId); // Go to specific action - try { + if (targetUser == null) { + await msg.Channel.SendMessageAsync(":x: Unable to find the specified user."); + } else { await ContinueInvoke(g, msg, logMessage, targetUser); - } catch (Discord.Net.HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.Forbidden) { - await msg.Channel.SendMessageAsync(":x: " + Messages.ForbiddenGenericError); } }