Class: Discordrb::Events::WebhookUpdateEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Discordrb::Events::WebhookUpdateEventHandler
- Defined in:
- lib/discordrb/events/webhooks.rb
Overview
Event handler for WebhookUpdateEvent
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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/discordrb/events/webhooks.rb', line 25 def matches?(event) # Check for the proper event type return false unless event.is_a? WebhookUpdateEvent [ 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[:channel], 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, matches_all(@attributes[:webhook], event) do |a, e| a == case a when String e.name when Integer e.id else e end end ].reduce(true, &:&) end |