Small improvement to the situation with no counters

This commit is contained in:
Chris Sexton 2013-01-23 16:45:37 -05:00
parent 5fc0d31db5
commit dbb2e97ba3
1 changed files with 6 additions and 0 deletions

View File

@ -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 {