diff --git a/discordMessage.go b/discordMessage.go index 0db0fa9..c9d9f8a 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -53,23 +53,30 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%+v please say \"!d bump\" without the quotes to bump our server :)", m.Author.Mention())) } if strings.Contains(m.Content, s.State.User.ID) { + log.LogDebug("%+v contained %+v", m.Content, s.State.User.ID) for _, cmd := range commands { for _, keyword := range cmd.Keywords { + log.LogDebug("Checking if %+v contains %+v", m.Content, keyword) if strings.Contains(m.Content, keyword) { + log.LogDebug("%+v found!", keyword) b.Command = keyword if !cmd.RequiresAdmin { + log.LogDebug("%+v does not require admin, running!") if !cmd.Exec(b) { s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("There was an error running %+v\n%+v", cmd.Name, cmd.Help)) } else { log.LogInfo("Ran command %+v for %+v", cmd.Name, m.Author.Username) } } else { + log.LogDebug("%+v does require admin, checking!") if isAdmin(m.Member) { if !cmd.Exec(b) { s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("There was an error running %+v\n%+v", cmd.Name, cmd.Help)) } else { log.LogInfo("Ran command %+v for %+v", cmd.Name, m.Author.Username) } + } else { + log.LogInfo("%+v tried to run an admin command (%+v) but isn't an admin.", m.Author.Username, keyword) } } }