From 09046f48dc40d26067a46ed78ad6826074f20992 Mon Sep 17 00:00:00 2001 From: Rudi Date: Wed, 24 Nov 2021 09:02:35 -0500 Subject: [PATCH] Add attempts to automatically fix bump timer. --- discordMessage.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/discordMessage.go b/discordMessage.go index d9038f7..6407538 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -4,13 +4,25 @@ import ( "fmt" "strings" "time" + "regexp" "github.com/bwmarrin/discordgo" ) func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { defer log.PanicSafe() - if m.Author.ID == s.State.User.ID || m.Author.Bot { + if m.Author.ID == "302050872383242240" && strings.Contains(m.Content, "minutes until the server can be bumped") { + re := regexp.MustCompile("Please wait another (.*) minutes until the server can be bumped") + match := re.FindStringSubmatch(m.Content) + m.Content = fmt.Sprintf("@Thanos bs %+v", match[1]) + s.ChannelMessageSend(config.AdminChannel, m.Content) + BumpSet(BotCommand{ + Message: m, + Session: s, + Parts: strings.Split(m.Content, " ")[2:], + }) + } + if m.Author.ID == s.State.User.ID || m.Author.Bot { return } if m.GuildID == "" {