only perform pinning functions on first/last pin #2
4
bot.rb
4
bot.rb
@ -35,7 +35,7 @@ bot.reaction_add do |event|
|
|||||||
end
|
end
|
||||||
|
|
||||||
if(event.emoji.name == PIN_EMOJI)
|
if(event.emoji.name == PIN_EMOJI)
|
||||||
event.message.pin
|
event.message.pin unless event.message.reactions.include? PIN_EMOJI
|
||||||
end
|
end
|
||||||
|
|
||||||
nil # `event` is of type Respondable, so the return line of the block needs to be nil to prevent the bot sending something in the chhannel the reaction occured.
|
nil # `event` is of type Respondable, so the return line of the block needs to be nil to prevent the bot sending something in the chhannel the reaction occured.
|
||||||
@ -43,7 +43,7 @@ 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
|
event.message.unpin unless event.message.reactions.include? PIN_EMOJI
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user