Skip to content

Commit

Permalink
fix: discord absent date check
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
  • Loading branch information
galexrt committed Nov 12, 2024
1 parent e7147c1 commit f574b1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/discord/commands/absent.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (c *AbsentCommand) HandleCommand(ctx context.Context, cmd cmdroute.CommandD
startDate = parsed

now := timeutils.TruncateToDay(time.Now())
if !startDate.After(now) {
if !(startDate.After(now) || now.Equal(startDate)) {
(*resp.Embeds)[0].Title = localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "discord.commands.absent.results.invalid_date.title"})
(*resp.Embeds)[0].Description = localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "discord.commands.absent.results.invalid_date.desc"})
return resp
Expand All @@ -195,7 +195,7 @@ func (c *AbsentCommand) HandleCommand(ctx context.Context, cmd cmdroute.CommandD

daysOptions := cmd.Data.Options.Find("days")
days, err := daysOptions.IntValue()
if err != nil {
if err != nil || days <= 0 {
(*resp.Embeds)[0].Title = localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "discord.commands.absent.results.failed.title"})
(*resp.Embeds)[0].Description = localizer.MustLocalize(&i18n.LocalizeConfig{MessageID: "discord.commands.absent.results.failed.desc"})
return resp
Expand Down

0 comments on commit f574b1c

Please sign in to comment.