Skip to content

Commit

Permalink
Don't cache empty close reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlOfDuty committed Feb 1, 2025
1 parent 87c5d55 commit f32a17c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Commands/CloseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ await command.RespondAsync(new DiscordEmbedBuilder

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);
}
}
}

Expand Down

0 comments on commit f32a17c

Please sign in to comment.