Browse Source

Remove bump chaser

master
Gregory Rudolph 2 years ago
parent
commit
d13ee51aa6
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 3
      config.go
  2. 19
      discordMessage.go

3
config.go

@ -98,9 +98,6 @@ func bumpTimer(s *discordgo.Session) {
bump = false bump = false
config.BumpTime = time.Now() config.BumpTime = time.Now()
time.Sleep(2 * time.Hour) time.Sleep(2 * time.Hour)
if time.Since(lastActiveTime) < (5 * time.Minute) {
s.ChannelMessageSend(lastActiveChan, "!d bump is ready, please use it. (say \"!d bump\" without the quotes)")
}
s.ChannelMessageSend(config.AdminChannel, "!d bump is ready.") s.ChannelMessageSend(config.AdminChannel, "!d bump is ready.")
bump = true bump = true
} }

19
discordMessage.go

@ -2,9 +2,9 @@ package main
import ( import (
"fmt" "fmt"
"regexp"
"strings" "strings"
"time" "time"
"regexp"
"github.com/bwmarrin/discordgo" "github.com/bwmarrin/discordgo"
) )
@ -12,18 +12,18 @@ import (
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
defer log.PanicSafe() defer log.PanicSafe()
if m.Author.ID == "302050872383242240" && len(m.Embeds) > 0 { if m.Author.ID == "302050872383242240" && len(m.Embeds) > 0 {
if strings.Contains(m.Embeds[0].Description, "minutes until the server can be bumped") { if strings.Contains(m.Embeds[0].Description, "minutes until the server can be bumped") {
log.LogDebug("Failed bump detected") log.LogDebug("Failed bump detected")
re := regexp.MustCompile("Please wait another (.*) minutes until the server can be bumped") re := regexp.MustCompile("Please wait another (.*) minutes until the server can be bumped")
match := re.FindStringSubmatch(m.Embeds[0].Description) match := re.FindStringSubmatch(m.Embeds[0].Description)
m.Content = fmt.Sprintf("%+v bs %+v", s.State.User.Mention(), match[1]) m.Content = fmt.Sprintf("%+v bs %+v", s.State.User.Mention(), match[1])
BumpSet(BotCommand{ BumpSet(BotCommand{
Message: m, Message: m,
Session: s, Session: s,
Parts: strings.Split(m.Content, " ")[2:], Parts: strings.Split(m.Content, " ")[2:],
}) })
} }
if strings.Contains(m.Embeds[0].Description, "Bump done!") { if strings.Contains(m.Embeds[0].Description, "Bump done!") {
log.LogDebug("Finding string %+v", m.Embeds[0].Description) log.LogDebug("Finding string %+v", m.Embeds[0].Description)
@ -35,7 +35,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
return return
} }
if m.Author.Bot || m.Author.ID == s.State.User.ID { if m.Author.Bot || m.Author.ID == s.State.User.ID {
return return
} }
if m.GuildID == "" { if m.GuildID == "" {
@ -52,7 +52,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
} }
return return
} }
if m.ChannelID != config.AdminChannel { if m.ChannelID != config.AdminChannel {
lastActiveChan = m.ChannelID lastActiveChan = m.ChannelID
lastActiveTime = time.Now() lastActiveTime = time.Now()
@ -103,11 +103,6 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
} }
} }
} }
} else {
log.LogDebug("strings.Contains(m.Content, s.State.User.ID) was false for %+v", m.Content)
if bump {
s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%+v please say \"!d bump\" without the quotes to bump our server :)", m.Author.Mention()))
}
} }
} }

Loading…
Cancel
Save