properly resolve pin wars

This commit is contained in:
Lera Elvoé 2022-10-26 14:06:13 +03:00
parent c66178451a
commit 6a10c6beb7
Signed by: yagich
SSH Key Fingerprint: SHA256:6xjGb6uA7lAVcULa7byPEN//rQ0wPoG+UzYVMfZnbvc

3
bot.rb
View File

@ -43,7 +43,8 @@ end
bot.reaction_remove do |event| bot.reaction_remove do |event|
next unless event.emoji.name == PIN_EMOJI 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 nil
end end