Skip to content

Commit

Permalink
/warn: Handle invalid reply msg ID
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Oct 28, 2024
1 parent e13c239 commit a4e2c46
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Commands/InteractionCommands/WarningInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ public async Task WarnSlashCommand(InteractionContext ctx,
.WithContent($"{Program.cfgjson.Emoji.Warning} {user.Mention} was warned: **{reason.Replace("`", "\\`").Replace("*", "\\*")}**");

if (replyMsgId != "0")
messageBuild.WithReply(Convert.ToUInt64(replyMsgId), true, false);
{
if (!ulong.TryParse(replyMsgId, out var msgId))
{
await ctx.FollowUpAsync(new DiscordFollowupMessageBuilder().WithContent($"{Program.cfgjson.Emoji.Error} Invalid reply message ID! Please try again.").AsEphemeral(true));
return;
}
messageBuild.WithReply(msgId, true, false);
}

var msg = await channel.SendMessageAsync(messageBuild);

Expand Down

0 comments on commit a4e2c46

Please sign in to comment.