Class: Discordrb::Events::ReactionRemoveAllEventHandler

Inherits:
EventHandler
  • Object
show all
Defined in:
lib/discordrb/events/reactions.rb

Overview

Event handler for ReactionRemoveAllEvent

Instance Method Summary collapse

Methods inherited from EventHandler

#after_call, #call, #initialize, #match, #matches_all

Constructor Details

This class inherits a constructor from Discordrb::Events::EventHandler

Instance Method Details

#matches?(event) ⇒ Boolean

Returns:

  • (Boolean)

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/discordrb/events/reactions.rb', line 135

def matches?(event)
  # Check for the proper event type
  return false unless event.is_a? ReactionRemoveAllEvent

  # No attributes yet as there is no property available on the event that doesn't involve doing a resolution request
  [
    matches_all(@attributes[:message], event.message_id) do |a, e|
      a == e
    end,
    matches_all(@attributes[:in], event.channel) do |a, e|
      if a.is_a? String
        # Make sure to remove the "#" from channel names in case it was specified
        a.delete('#') == e.name
      elsif a.is_a? Integer
        a == e.id
      else
        a == e
      end
    end
  ].reduce(true, &:&)
end