actually use cmderror type
This commit is contained in:
parent
5977a65ef1
commit
891e83b54c
5
util.go
5
util.go
@ -22,10 +22,11 @@ func ParseCommand(evt *event.Event, prefix string) ([]string, error) {
|
|||||||
body := evt.Content.AsMessage().Body
|
body := evt.Content.AsMessage().Body
|
||||||
bodyS := strings.Split(body, " ")
|
bodyS := strings.Split(body, " ")
|
||||||
if bodyS[0] != fmt.Sprintf("!%v", prefix) {
|
if bodyS[0] != fmt.Sprintf("!%v", prefix) {
|
||||||
return []string{}, errors.New("no prefix found")
|
return []string{}, ErrCmdParseNoPrefix
|
||||||
|
|
||||||
}
|
}
|
||||||
if len(bodyS) < 2 {
|
if len(bodyS) < 2 {
|
||||||
return []string{}, errors.New("nothing to parse from command")
|
return []string{}, ErrCmdParseNoCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
return bodyS[1:], nil
|
return bodyS[1:], nil
|
||||||
|
Loading…
Reference in New Issue
Block a user