From fbd1f1f8ca90c3e3813981cb2cf0a1f33adc1f9a Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Tue, 4 May 2021 14:41:14 -0400 Subject: [PATCH] Fix reboot timer --- config.go | 7 +++++++ main.go | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 8ca52dd..921107d 100644 --- a/config.go +++ b/config.go @@ -65,6 +65,13 @@ func status(s *discordgo.Session) { go runPurge(s) return } + +func rebootBump() { + time.Sleep(time.Until(config.BumpTime.Add(2 * time.Hour))) + dg.ChannelMessageSend(config.AdminChannel, "!d bump is ready") + +} + func storeVerification(v Verification) { defer log.PanicSafe() fileURL, _ := url.Parse(v.Photo) diff --git a/main.go b/main.go index 51695cd..001fb5f 100644 --- a/main.go +++ b/main.go @@ -81,9 +81,7 @@ func main() { log.LogInfo("Thanos is now running. Press CTRL-C to exit.") go purgeTimer(dg) - if time.Since(config.BumpTime) > 2*time.Hour { - dg.ChannelMessageSend(config.AdminChannel, "!d bump is ready") - } + go rebootBump() sc := make(chan os.Signal, 1) signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill) <-sc