class Discordrb::Events::MessageIDEventHandler

Event handler for {MessageIDEvent}

Public Instance Methods

matches?(event) click to toggle source
# File lib/discordrb/events/message.rb, line 296
def matches?(event)
  # Check for the proper event type
  return false unless event.is_a? MessageIDEvent

  [
    matches_all(@attributes[:id], event.id) do |a, e|
      a.resolve_id == e.resolve_id
    end,
    matches_all(@attributes[:in], event.channel) do |a, e|
      case a
      when String
        # Make sure to remove the "#" from channel names in case it was specified
        a.delete('#') == e.name
      when Integer
        a == e.id
      else
        a == e
      end
    end
  ].reduce(true, &:&)
end