From df2f2e63c950d2f6c2996b7002cf21a9a82c21ac Mon Sep 17 00:00:00 2001 From: Toastie <toastie@toastiet0ast.com> Date: Thu, 6 Feb 2025 15:20:58 +1300 Subject: [PATCH] Don't cache empty close reasons --- Commands/CloseCommand.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Commands/CloseCommand.cs b/Commands/CloseCommand.cs index b4da76f..4935e33 100644 --- a/Commands/CloseCommand.cs +++ b/Commands/CloseCommand.cs @@ -46,13 +46,16 @@ public class CloseCommand await command.RespondAsync(confirmation); - if (closeReasons.TryGetValue(command.Channel.Id, out _)) + if (!string.IsNullOrWhiteSpace(reason)) { - closeReasons[command.Channel.Id] = reason; - } - else - { - closeReasons.Add(command.Channel.Id, reason); + if (closeReasons.TryGetValue(command.Channel.Id, out _)) + { + closeReasons[command.Channel.Id] = reason; + } + else + { + closeReasons.Add(command.Channel.Id, reason); + } } }