This repository has been archived on 2022-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
go-musicbot/args.go
2021-07-28 17:30:01 +02:00

17 lines
462 B
Go

// Parses the commands sent through Discord. This program does not use any
// traditional command line options, as it uses config.json for configuration.
package main
import (
"strings"
)
// Returns a false and a nil slice if cmd was not intended for the bot.
func CmdGetArgs(cmd string) (args []string, ok bool) {
if !strings.HasPrefix(cmd, cfg.Prefix) {
return nil, false
}
cmd = strings.TrimPrefix(cmd, cfg.Prefix)
return strings.Fields(cmd), true
}