Listen for successful bumps
This commit is contained in:
@ -12,7 +12,8 @@ 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 && strings.Contains(m.Embeds[0].Description, "minutes until the server can be bumped") {
|
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")
|
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)
|
||||||
@ -22,6 +23,20 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|||||||
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!") {
|
||||||
|
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 {
|
if m.Author.Bot || m.Author.ID == s.State.User.ID {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user