commit 36f278f

Alexey Yerin  ·  2021-05-17 19:10:17 +0000 UTC
parent 4764c14
commands: ignore empty input

Prior to this, when sending nothing, senpai throws the following
nonsense at you:

    "": usage:

Now empty input is ignored, preventing this from appearing
(whitespace-only message should still work).
1 files changed,  +4, -0
+4, -0
 1@@ -350,6 +350,10 @@ func parseCommand(s string) (command, args string) {
 2 func (app *App) handleInput(buffer, content string) error {
 3 	cmdName, rawArgs := parseCommand(content)
 4 
 5+	if content == "" {
 6+		return nil
 7+	}
 8+
 9 	var chosenCMDName string
10 	var ok bool
11 	for key := range commands {