Class: Discordrb::Events::PlayingEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Discordrb::Events::PlayingEventHandler
- Defined in:
- lib/discordrb/events/presence.rb
Overview
Event handler for PlayingEvent
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
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/discordrb/events/presence.rb', line 84 def matches?(event) # Check for the proper event type return false unless event.is_a? PlayingEvent [ 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[:game], event.game) do |a, e| a == if a.is_a? String e.name else e end end, matches_all(@attributes[:type], event.type) do |a, e| a == if a.is_a? Integer e.type else e end end ].reduce(true, &:&) end |