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)

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/discordrb/events/guilds.rb', line 166

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 == if a.is_a? String
             e.name
           elsif a.is_a? 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