actually use cmderror type

This commit is contained in:
stryan 2022-07-17 18:22:57 -04:00
parent 5977a65ef1
commit 891e83b54c
1 changed files with 3 additions and 2 deletions

View File

@ -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