Class: Rubycord::Events::ServerEventHandler

Inherits:
EventHandler show all
Defined in:
lib/rubycord/events/guilds.rb

Overview

Generic event handler for member events

Instance Method Summary collapse

Methods inherited from EventHandler

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

Constructor Details

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

Instance Method Details

#matches?(event) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubycord/events/guilds.rb', line 25

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

  [
    matches_all(@attributes[:server], event.server) do |a, e|
      a == case a
      when String
        e.name
      when Integer
        e.id
      else
        e
      end
    end
  ].reduce(true, &:&)
end