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

#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)


38
39
40
41
42
43
44
45
46
# File 'lib/discordrb/events/await.rb', line 38

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