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) { @@ -98,9 +98,6 @@ func bumpTimer(s *discordgo.Session) {
bump = false
config.BumpTime = time.Now()
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.")
bump = true
}

19
discordMessage.go

@ -2,9 +2,9 @@ package main @@ -2,9 +2,9 @@ package main
import (
"fmt"
"regexp"
"strings"
"time"
"regexp"
"github.com/bwmarrin/discordgo"
)
@ -12,18 +12,18 @@ import ( @@ -12,18 +12,18 @@ import (
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
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") {
log.LogDebug("Failed bump detected")
re := regexp.MustCompile("Please wait another (.*) minutes until the server can be bumped")
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{
Message: m,
Session: s,
Parts: strings.Split(m.Content, " ")[2:],
Parts: strings.Split(m.Content, " ")[2:],
})
}
if strings.Contains(m.Embeds[0].Description, "Bump done!") {
log.LogDebug("Finding string %+v", m.Embeds[0].Description)
@ -35,7 +35,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { @@ -35,7 +35,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
return
}
if m.Author.Bot || m.Author.ID == s.State.User.ID {
if m.Author.Bot || m.Author.ID == s.State.User.ID {
return
}
if m.GuildID == "" {
@ -52,7 +52,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { @@ -52,7 +52,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
}
return
}
if m.ChannelID != config.AdminChannel {
lastActiveChan = m.ChannelID
lastActiveTime = time.Now()
@ -103,11 +103,6 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { @@ -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