From cfb3c5b57b51f31ba455f247e1d838af8725f4a0 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Wed, 5 May 2021 20:30:04 -0400 Subject: [PATCH] Add bumpset --- config.go | 10 ++++++++++ main.go | 3 +++ 2 files changed, 13 insertions(+) diff --git a/config.go b/config.go index 921107d..fea5a53 100644 --- a/config.go +++ b/config.go @@ -141,6 +141,16 @@ func saveConfig() { } } +func bumpSetTime(s *discordgo.Session, m *discordgo.MessageCreate) { + bump = false + parts := strings.Split(m.Content, " ") + timer, err := strconv.Atoi(parts[1]) + if err != nil { + s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("Unable to decode timer: %+v", parts[1])) + } + config.BumpTime = time.Now().Add(time.Duration(timer) * time.Minute).Add(-2 * time.Hour) + s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("New bump time: %+v, expecting bump at %+v", config.BumpTime, config.BumpTime.Add(2*time.Hour))) +} func findVerification(s *discordgo.Session, m *discordgo.MessageCreate) { defer log.PanicSafe() parts := strings.Split(m.Content, " ") diff --git a/main.go b/main.go index 001fb5f..d0e75bf 100644 --- a/main.go +++ b/main.go @@ -366,6 +366,9 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { if strings.HasPrefix(m.Content, rebootToken) { exit(s) } + if strings.HasPrefix(m.Content, "!bumpset") { + bumpSetTime(s, m) + } if strings.HasPrefix(m.Content, "!veri") { findVerification(s, m) }