29 lines
465 B
Go
29 lines
465 B
Go
|
package commands
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/bwmarrin/discordgo"
|
||
|
|
||
|
"PermissionGacha/modules/config"
|
||
|
)
|
||
|
|
||
|
func Parse(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||
|
if m.Author.Bot {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
if !strings.HasPrefix(m.Content, config.CommandPrefix) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
commands := strings.Split(strings.TrimPrefix(m.Content, config.CommandPrefix), " ")
|
||
|
|
||
|
for _, v := range list {
|
||
|
if v.Name == commands[0] {
|
||
|
v.Handler(s, commands, m)
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
}
|