Class: Discordrb::Events::AwaitEventHandler

Inherits:
EventHandler show all
Defined in:
lib/discordrb/events/await.rb

Overview

Event handler for AwaitEvent

Instance Method Summary collapse

Methods inherited from EventHandler

#call, #initialize, #match, #matches_all

Constructor Details

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

Instance Method Details

#matches?(event) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
# File 'lib/discordrb/events/await.rb', line 19

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

  [
    matches_all(@attributes[:key], event.key) { |a, e| a == e },
    matches_all(@attributes[:type], event.type) { |a, e| a == e }
  ].reduce(true, &:&)
end