class Discordrb::Events::ReactionRemoveAllEventHandler

Event handler for {ReactionRemoveAllEvent}

Public Instance Methods

matches?(event) click to toggle source
# File lib/discordrb/events/reactions.rb, line 136
def matches?(event)
  # Check for the proper event type
  return false unless event.is_a? ReactionRemoveAllEvent

  [
    matches_all(@attributes[:message], event.message_id) do |a, e|
      a == e
    end,
    matches_all(@attributes[:in], event.channel) do |a, e|
      case a
      when String
        # Make sure to remove the "#" from channel names in case it was specified
        a.delete('#') == e.name
      when Integer
        a == e.id
      else
        a == e
      end
    end
  ].reduce(true, &:&)
end