Don't cache empty close reasons

This commit is contained in:
Toastie 2025-02-06 15:20:58 +13:00
parent ff2a9e54e4
commit df2f2e63c9
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7

View file

@ -46,13 +46,16 @@ public class CloseCommand
await command.RespondAsync(confirmation); await command.RespondAsync(confirmation);
if (closeReasons.TryGetValue(command.Channel.Id, out _)) if (!string.IsNullOrWhiteSpace(reason))
{ {
closeReasons[command.Channel.Id] = reason; if (closeReasons.TryGetValue(command.Channel.Id, out _))
} {
else closeReasons[command.Channel.Id] = reason;
{ }
closeReasons.Add(command.Channel.Id, reason); else
{
closeReasons.Add(command.Channel.Id, reason);
}
} }
} }