diff --git a/discordMessage.go b/discordMessage.go index 3d922ba..7aba5b8 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -66,17 +66,18 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { s.ChannelMessageDelete(m.ChannelID, m.ID) } } + parts := strings.Split(m.Content, " ") if strings.Contains(m.Content, s.State.User.ID) { b := BotCommand{ Session: s, Message: m, - Parts: strings.Split(m.Content, " ")[2:], + Parts: parts[2:], } log.LogDebug("%+v", b.Parts) for _, cmd := range commands { for _, keyword := range cmd.Keywords { log.LogDebug("Checking if %+v contains %+v", m.Content, keyword) - if strings.Contains(b.Parts[1], keyword) { + if strings.Contains(parts[1], keyword) { log.LogDebug("%+v found!", keyword) b.Command = keyword if !cmd.RequiresAdmin {