Skip to content

Commit

Permalink
automoji: fix max limiting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frioux committed Jan 2, 2021
1 parent d4493e2 commit 7be15fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/tool/automoji/automoji.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 7be15fd

Please sign in to comment.