Class: Discordrb::Events::ServerEmojiUpdateEventHandler

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

Overview

Event handler for ServerEmojiUpdateEvent

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)


172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/discordrb/events/guilds.rb', line 172

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

  [
    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[:id], event.old_emoji.id) { |a, e| a.resolve_id == e.resolve_id },
    matches_all(@attributes[:old_name], event.old_emoji.name) { |a, e| a == e },
    matches_all(@attributes[:name], event.emoji.name) { |a, e| a == e }
  ].reduce(true, &:&)
end