Class: Discordrb::Events::ServerEmojiCDEventHandler

Inherits:
ServerEventHandler show all
Defined in:
lib/discordrb/events/guilds.rb

Overview

Generic handler for emoji create and delete

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)


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/discordrb/events/guilds.rb', line 138

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

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