discover the existence of strings.Cut
parent
6d6e6d5726
commit
8a56e79f5d
|
@ -60,13 +60,7 @@ func (cs *ClientState) HandleInput(input string) error {
|
||||||
var verb string
|
var verb string
|
||||||
rest := input
|
rest := input
|
||||||
if strings.HasPrefix(input, "/") {
|
if strings.HasPrefix(input, "/") {
|
||||||
// TODO this is def broken lol
|
verb, rest, _ = strings.Cut(input[1:], " ")
|
||||||
input = input[1:]
|
|
||||||
parts := strings.SplitN(input, " ", 1)
|
|
||||||
verb = parts[0]
|
|
||||||
if len(parts) > 1 {
|
|
||||||
rest = parts[1]
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
verb = "say"
|
verb = "say"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue