Browse Source

Listen for successful bumps

master
Gregory Rudolph 2 years ago
parent
commit
cf494d4c11
  1. 35
      discordMessage.go

35
discordMessage.go

@ -12,16 +12,31 @@ import ( @@ -12,16 +12,31 @@ import (
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
defer log.PanicSafe()
if m.Author.ID == "302050872383242240" && len(m.Embeds) > 0 && 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])
BumpSet(BotCommand{
Message: m,
Session: s,
Parts: strings.Split(m.Content, " ")[2:],
})
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])
BumpSet(BotCommand{
Message: m,
Session: s,
Parts: strings.Split(m.Content, " ")[2:],
})
}
if strings.Contains(m.Embeds[0].Description, "Bump done!") {
log.LogDebug("Finding string %+v", m.Embeds[0].Description)
if time.Since(config.BumpTime) < 2*time.Hour {
//s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("Sorry, <@%+v> already claimed the bump. Better luck next time!", config.LastBumper))
return
}
activeInteraction(s, m.Author.ID)
config.LastBumper = m.Author.ID
//go bumpTimer(s)
}
return
}
if m.Author.Bot || m.Author.ID == s.State.User.ID {
return

Loading…
Cancel
Save