|
|
@ -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,16 +12,16 @@ 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:], |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -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 == "" { |
|
|
@ -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())) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|