From 6a10c6beb79fe8e622681b10ea6ae3c14e564d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 26 Oct 2022 14:06:13 +0300 Subject: [PATCH] properly resolve pin wars --- bot.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot.rb b/bot.rb index 446d21d..94965f6 100644 --- a/bot.rb +++ b/bot.rb @@ -43,7 +43,8 @@ end bot.reaction_remove do |event| next unless event.emoji.name == PIN_EMOJI - event.message.unpin unless event.message.reactions.include? PIN_EMOJI + pin_reactions = event.message.reactions.filter {|el| el.name == PIN_EMOJI} + event.message.unpin if pin_reactions.empty? nil end