From dbb2e97ba328e11750d511f673c873f559f626b1 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Wed, 23 Jan 2013 16:45:37 -0500 Subject: [PATCH] Small improvement to the situation with no counters --- plugins/counter.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/counter.go b/plugins/counter.go index fe1a7ff..0a87bd0 100644 --- a/plugins/counter.go +++ b/plugins/counter.go @@ -55,6 +55,12 @@ func (p *CounterPlugin) Message(message bot.Message) bool { // pull all of the items associated with "subject" var items []Item p.Coll.Find(bson.M{"nick": subject}).All(&items) + + if len(items) == 0 { + p.Bot.SendMessage(channel, fmt.Sprintf("%s has no counters.", subject)) + return true + } + resp := fmt.Sprintf("%s has the following counters:", subject) for i, item := range items { if i != 0 {