Class: Discordrb::Events::InviteDeleteEventHandler

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

Overview

Event handler for InviteDeleteEvent

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)

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/discordrb/events/invites.rb', line 98

def matches?(event)
  return false unless event.is_a? InviteDeleteEvent

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