counter: make matched things decrement sometimes

This commit is contained in:
Chris Sexton 2020-01-21 16:26:06 -05:00 committed by Chris Sexton
parent 99817ad621
commit 7f183b4f2a
1 changed files with 5 additions and 1 deletions

View File

@ -541,7 +541,11 @@ func (p *CounterPlugin) checkMatch(c bot.Connector, message msg.Message) bool {
return false
}
log.Debug().Msgf("About to update item: %#v", item)
item.UpdateDelta(1)
delta := 1
if item.Count < 0 {
delta = -1
}
item.UpdateDelta(delta)
p.Bot.Send(c, bot.Message, channel, fmt.Sprintf("%s... %s has %d %s",
strings.Join(everyDayImShuffling([]string{"bleep", "bloop", "blop"}), "-"), nick, item.Count, itemName))
return true