This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
2019-11-27 10:40:31 +07:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
|
|
|
|
"PermissionGacha/modules/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Parse(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|
|
|
if m.Author.Bot {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-01-28 16:48:07 +07:00
|
|
|
if !strings.HasPrefix(strings.ToLower(m.Content), config.CommandPrefix) {
|
2019-11-27 10:40:31 +07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-01-28 16:48:07 +07:00
|
|
|
commands := strings.Split(m.Content[len(config.CommandPrefix):], " ")
|
|
|
|
first := strings.ToLower(commands[0])
|
2019-11-27 10:40:31 +07:00
|
|
|
|
|
|
|
for _, v := range list {
|
2020-01-28 16:48:07 +07:00
|
|
|
if v.Name == first {
|
2019-11-27 10:40:31 +07:00
|
|
|
v.Handler(s, commands, m)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|