Skip to content

Commit

Permalink
Fix: Check if date is in the past when parsing timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
sthivaios committed Nov 4, 2024
1 parent 3a7211c commit 9a296b0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Commands/Reminders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ public async Task RemindMe(
else
{
t = HumanDateParser.HumanDateParser.Parse(timetoParse);
if (t <= DateTime.Now)
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time can't be in the past!");
return;
}
#if !DEBUG
else if (t < (DateTime.Now + TimeSpan.FromSeconds(59)))
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time must be at least a minute in the future!");
return;
}
#endif
}

if (t <= DateTime.Now)
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time can't be in the past!");
return;
}
#if !DEBUG
else if (t < (DateTime.Now + TimeSpan.FromSeconds(59)))
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time must be at least a minute in the future!");
return;
}
#endif

string guildId;

Expand Down

0 comments on commit 9a296b0

Please sign in to comment.