Class: Discordrb::Events::VoiceStateUpdateEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Discordrb::Events::VoiceStateUpdateEventHandler
- Defined in:
- lib/discordrb/events/voice_state_update.rb
Overview
Event handler for VoiceStateUpdateEvent
Instance Method Summary collapse
Methods inherited from EventHandler
#initialize, #match, #matches_all
Constructor Details
This class inherits a constructor from Discordrb::Events::EventHandler
Instance Method Details
#matches?(event) ⇒ Boolean
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/discordrb/events/voice_state_update.rb', line 36 def matches?(event) # Check for the proper event type return false unless event.is_a? VoiceStateUpdateEvent [ matches_all(@attributes[:from], event.user) do |a, e| if a.is_a? String a == e.name elsif a.is_a? Fixnum a == e.id else a == e end end, matches_all(@attributes[:mute], event.mute) do |a, e| if a.is_a? Boolean a == e.to_s else a == e end end, matches_all(@attributes[:deaf], event.deaf) do |a, e| if a.is_a? Boolean a == e.to_s else a == e end end, matches_all(@attributes[:self_mute], event.self_mute) do |a, e| if a.is_a? Boolean a == e.to_s else a == e end end, matches_all(@attributes[:self_deaf], event.self_deaf) do |a, e| if a.is_a? Boolean a == e.to_s else a == e end end, matches_all(@attributes[:channel], event.channel) do |a, e| if a.is_a? String a == e.name elsif a.is_a? Fixnum a == e.id else a == e end end ].reduce(true, &:&) end |