Class: Discordrb::Events::ChannelDeleteEventHandler

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

Overview

Event handler for ChannelDeleteEvent

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)


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

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

  [
    matches_all(@attributes[:type], event.type) do |a, e|
      a == if a.is_a? String
             e.name
           else
             e
           end
    end,
    matches_all(@attributes[:name], event.name) do |a, e|
      a == if a.is_a? String
             e.to_s
           else
             e
           end
    end
  ].reduce(true, &:&)
end