Fix error message when using close command after already having set a close reason

This commit is contained in:
Toastie 2025-02-04 21:20:19 +13:00
parent 9fcd1ddeac
commit 3a602db94f
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7

View file

@ -43,7 +43,15 @@ public class CloseCommand
.AddComponents(new DiscordButtonComponent(DiscordButtonStyle.Danger, "supportchild_closeconfirm", "Confirm"));
await command.RespondAsync(confirmation);
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);
}
}
public static async Task OnConfirmed(DiscordInteraction interaction)