Class: Rubycord::Events::ThreadCreateEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Rubycord::Events::ThreadCreateEventHandler
- Defined in:
- lib/rubycord/events/threads.rb
Overview
Event handler for ChannelCreateEvent
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from EventHandler
#after_call, #call, #initialize, #match, #matches_all
Constructor Details
This class inherits a constructor from Rubycord::Events::EventHandler
Instance Method Details
#matches?(event) ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rubycord/events/threads.rb', line 17 def matches?(event) # Check for the proper event type return false unless event.is_a? ThreadCreateEvent [ matches_all(@attributes[:name], event.name) do |a, e| a == if a.is_a? String e.to_s else e end end, matches_all(@attributes[:server], event.server) do |a, e| a.resolve_id == e.resolve_id end, matches_all(@attributes[:invitable], event.thread.invitable) do |a, e| a == e end, matches_all(@attributes[:owner], event.thread.owner) do |a, e| a.resolve_id == e.resolve_id end, matches_all(@attributes[:channel], event.thread.parent) do |a, e| a.resolve_id == e.resolve_id end ].reduce(true, &:&) end |