add code
This commit is contained in:
16
args.go
Normal file
16
args.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user