Browse Source

make sure there is embed before trying operations

master
Gregory Rudolph 3 years ago
parent
commit
931825bd5a
  1. 2
      discordMessage.go

2
discordMessage.go

@ -11,7 +11,7 @@ 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" && strings.Contains(m.Embeds[0].Description, "minutes until the server can be bumped") { 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") 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)

Loading…
Cancel
Save