class Discordrb::Events::VoiceStateUpdateEventHandler
Event
handler for VoiceStateUpdateEvent
Public Instance Methods
matches?(event)
click to toggle source
# File lib/discordrb/events/voice_state_update.rb, line 35 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| a == if a.is_a? String e.name elsif a.is_a? Integer e.id else e end end, matches_all(@attributes[:mute], event.mute) do |a, e| a == if a.is_a?(TrueClass) || a.is_a?(FalseClass) e.to_s else e end end, matches_all(@attributes[:deaf], event.deaf) do |a, e| a == if a.is_a?(TrueClass) || a.is_a?(FalseClass) e.to_s else e end end, matches_all(@attributes[:self_mute], event.self_mute) do |a, e| a == if a.is_a?(TrueClass) || a.is_a?(FalseClass) e.to_s else e end end, matches_all(@attributes[:self_deaf], event.self_deaf) do |a, e| a == if a.is_a?(TrueClass) || a.is_a?(FalseClass) 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 == if a.is_a? String e.name elsif a.is_a? 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 == if a.is_a? String e.name elsif a.is_a? Integer e.id else e end end ].reduce(true, &:&) end