From d7e28813548d4d0b38a82cf42bf10b23fcdd0cb4 Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Wed, 25 Mar 2020 06:43:59 -0600 Subject: [PATCH] fix index issue --- handlers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/handlers.go b/handlers.go index 6d2d6f4..5466e26 100644 --- a/handlers.go +++ b/handlers.go @@ -65,7 +65,10 @@ func (b *bot) chatHandler(m chat1.MsgSummary) { words := strings.Fields(m.Content.Text.Body) // strip the ! from the first word, and lowercase to derive the command thisCommand := strings.ToLower(strings.Replace(words[0], "!", "", 1)) - maybeSubCommand := strings.ToLower(words[1]) + maybeSubCommand := "" + if len(words) > 1 { + maybeSubCommand = strings.ToLower(words[1]) + } // decide if this is askind for extended commands switch thisCommand { case "jitsi":