Class: OnyxCord::Events::VoiceStateUpdateEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- OnyxCord::Events::VoiceStateUpdateEventHandler
- Defined in:
- lib/onyxcord/events/voice/state_update.rb
Overview
Event handler for VoiceStateUpdateEvent
Instance Method Summary collapse
Methods inherited from EventHandler
#after_call, #call, #match, #matches_all
Instance Method Details
#matches?(event) ⇒ Boolean
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/onyxcord/events/voice/state_update.rb', line 65 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| next unless e a == case a when String e.name when Integer e.id else e end end, matches_all(@attributes[:mute], event.mute) do |a, e| a == if a.is_a? String e.to_s else e end end, matches_all(@attributes[:deaf], event.deaf) do |a, e| a == if a.is_a? String e.to_s else e end end, matches_all(@attributes[:self_mute], event.self_mute) do |a, e| a == if a.is_a? String e.to_s else e end end, matches_all(@attributes[:self_deaf], event.self_deaf) do |a, e| a == if a.is_a? String e.to_s else e end end, matches_all(@attributes[:channel], event.channel) do |a, e| next unless e # Don't bother if the channel is nil a == case a when String e.name when Integer e.id else e end end, matches_all(@attributes[:old_channel], event.old_channel) do |a, e| next unless e # Don't bother if the channel is nil a == case a when String e.name when Integer e.id else e end end ].reduce(true, &:&) end |