Class: Discordrb::Events::TypingEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Discordrb::Events::TypingEventHandler
- Defined in:
- lib/discordrb/events/typing.rb
Overview
Event handler for TypingEvent
Instance Method Summary collapse
Methods inherited from EventHandler
#call, #initialize, #match, #matches_all
Constructor Details
This class inherits a constructor from Discordrb::Events::EventHandler
Instance Method Details
#matches?(event) ⇒ Boolean
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/discordrb/events/typing.rb', line 19 def matches?(event) # Check for the proper event type return false unless event.is_a? TypingEvent [ matches_all(@attributes[:in], event.channel) do |a, e| if a.is_a? String a.delete('#') == e.name elsif a.is_a? Fixnum a == e.id else a == e end end, matches_all(@attributes[:from], event.user) do |a, e| a == if a.is_a? String e.name elsif a.is_a? Fixnum e.id else e end end, matches_all(@attributes[:after], event.) { |a, e| a > e }, matches_all(@attributes[:before], event.) { |a, e| a < e } ].reduce(true, &:&) end |