From 7be15fd5e1c6311385b175ff1fbb9d0acfc306ce Mon Sep 17 00:00:00 2001 From: Arthur Axel 'fREW' Schmidt Date: Sat, 2 Jan 2021 15:30:34 -0800 Subject: [PATCH] automoji: fix max limiting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were setting max by passing it to es.all *and* here. This meant that if we requested a max of 1 but *also* had a required emoji (like we often do with 🎰) the required emoji ends up taking up a slot, and in fact ends up not required. Now required emoji effectively do not end up counting against our max. --- internal/tool/automoji/automoji.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/tool/automoji/automoji.go b/internal/tool/automoji/automoji.go index 063be8b..4ec91ff 100644 --- a/internal/tool/automoji/automoji.go +++ b/internal/tool/automoji/automoji.go @@ -137,7 +137,7 @@ func react(s *discordgo.Session, channelID, messageID string, es *emojiSet) { reactTotal.WithLabelValues(strconv.Itoa(max)).Inc() for i, e := range es.all(max) { // the 20 here is to limit to possibly fewer than were returned - if i == max || i == 20 { + if i == 20 { break } if err := s.MessageReactionAdd(channelID, messageID, e); err != nil {