From 7f183b4f2af726eaa507d739bf6eabfe6ba0e71d Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 21 Jan 2020 16:26:06 -0500 Subject: [PATCH] counter: make matched things decrement sometimes --- plugins/counter/counter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/counter/counter.go b/plugins/counter/counter.go index 66a47f6..cc2d57e 100644 --- a/plugins/counter/counter.go +++ b/plugins/counter/counter.go @@ -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