|
|
@ -66,17 +66,18 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { |
|
|
|
s.ChannelMessageDelete(m.ChannelID, m.ID) |
|
|
|
s.ChannelMessageDelete(m.ChannelID, m.ID) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
parts := strings.Split(m.Content, " ") |
|
|
|
if strings.Contains(m.Content, s.State.User.ID) { |
|
|
|
if strings.Contains(m.Content, s.State.User.ID) { |
|
|
|
b := BotCommand{ |
|
|
|
b := BotCommand{ |
|
|
|
Session: s, |
|
|
|
Session: s, |
|
|
|
Message: m, |
|
|
|
Message: m, |
|
|
|
Parts: strings.Split(m.Content, " ")[2:], |
|
|
|
Parts: parts[2:], |
|
|
|
} |
|
|
|
} |
|
|
|
log.LogDebug("%+v", b.Parts) |
|
|
|
log.LogDebug("%+v", b.Parts) |
|
|
|
for _, cmd := range commands { |
|
|
|
for _, cmd := range commands { |
|
|
|
for _, keyword := range cmd.Keywords { |
|
|
|
for _, keyword := range cmd.Keywords { |
|
|
|
log.LogDebug("Checking if %+v contains %+v", m.Content, keyword) |
|
|
|
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) |
|
|
|
log.LogDebug("%+v found!", keyword) |
|
|
|
b.Command = keyword |
|
|
|
b.Command = keyword |
|
|
|
if !cmd.RequiresAdmin { |
|
|
|
if !cmd.RequiresAdmin { |
|
|
|