Class: Discordrb::Events::ServerEventHandler

Inherits:
EventHandler show all
Defined in:
lib/discordrb/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 Discordrb::Events::EventHandler

Instance Method Details

#matches?(event) ⇒ Boolean

Returns:

  • (Boolean)


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

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 == if a.is_a? String
             e.name
           elsif a.is_a? Integer
             e.id
           else
             e
           end
    end
  ].reduce(true, &:&)
end