From 88c2736f5a229e1e053366aeb829f5e48c00d8a6 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sun, 17 Jan 2016 10:29:14 -0500 Subject: [PATCH] Fix bug with empty commands --- plugins/admin.go | 4 ++++ plugins/downtime.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plugins/admin.go b/plugins/admin.go index b14066e..7a8f1cb 100644 --- a/plugins/admin.go +++ b/plugins/admin.go @@ -42,6 +42,10 @@ func (p *AdminPlugin) Message(message bot.Message) bool { body := message.Body + if len(body) == 0 { + return false + } + if body[0] == '$' { return p.handleVariables(message) } diff --git a/plugins/downtime.go b/plugins/downtime.go index e444e38..f6f387f 100644 --- a/plugins/downtime.go +++ b/plugins/downtime.go @@ -129,6 +129,10 @@ func (p *DowntimePlugin) Message(message bot.Message) bool { channel := message.Channel ret := false + if len(parts) == 0 { + return false + } + if parts[0] == "idle" && len(parts) == 2 { nick := parts[1] // parts[1] must be the userid, or we don't know them