Skip to content

Commit

Permalink
Added timezone to OBII update
Browse files Browse the repository at this point in the history
  • Loading branch information
1nv8rzim committed Sep 6, 2023
1 parent cefcb79 commit b63cb9b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions commands/scheduled/update.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package scheduled

import (
"time"

"github.com/bwmarrin/discordgo"
"github.com/robfig/cron"
"gitlab.ritsec.cloud/1nv8rZim/ops-bot-iii/helpers"
Expand Down Expand Up @@ -56,10 +58,16 @@ func Update() *structs.ScheduledEvent {
)
defer span.Finish()

c := cron.New()
est, err := time.LoadLocation("America/New_York")
if err != nil {
logging.Error(s, err.Error(), nil, span)
return err
}

c := cron.NewWithLocation(est)

// every day at 2am
err := c.AddFunc("0 0 2 * * *", func() { updateOBIII(s, span.Context()) })
err = c.AddFunc("0 0 2 * * *", func() { updateOBIII(s, span.Context()) })
if err != nil {
return err
}
Expand Down

0 comments on commit b63cb9b

Please sign in to comment.