class Discorb::VoiceState
Attributes
@return [Boolean] Whether the user is streaming.
@return [Discorb::Member] The member associated with this voice state.
@return [Time] The time at which the user requested to speak.
@return [Boolean] Whether the user is deafened.
@return [Boolean] Whether the user is deafened.
@return [Boolean] Whether the user is muted.
@return [Boolean] Whether the user is muted.
@return [Boolean] Whether the user is streaming.
@return [Boolean] Whether the user is video-enabled.
@return [Discorb::Snowflake] The ID of the guild this voice state is for.
@return [Boolean] Whether the user is streaming.
@return [Boolean] Whether the user is suppressed. (Is at audience)
@return [Boolean] Whether the user is suppressed. (Is at audience)
@return [Boolean] Whether the user is video-enabled.
Public Class Methods
@!visibility private
# File lib/discorb/voice_state.rb, line 47 def initialize(client, data) @client = client _set_data(data) end
Public Instance Methods
# File lib/discorb/voice_state.rb, line 72 def channel @channel_id && @client.channels[@channel_id] end
# File lib/discorb/voice_state.rb, line 52 def deaf? @deaf || @self_deaf end
# File lib/discorb/voice_state.rb, line 68 def guild @guild_id && @client.guilds[@guild_id] end
# File lib/discorb/voice_state.rb, line 56 def mute? @mute || @self_mute end
# File lib/discorb/voice_state.rb, line 60 def server_deaf? @deaf end
# File lib/discorb/voice_state.rb, line 64 def server_mute? @mute end
# File lib/discorb/voice_state.rb, line 76 def user @client.users[@user_id] end
Private Instance Methods
# File lib/discorb/voice_state.rb, line 82 def _set_data(data) @data = data @guild_id = data[:guild_id] @channel_id = data[:channel_id] @user_id = data[:user_id] unless guild.nil? @member = if data.key?(:member) guild.members[data[:user_id]] || Member.new(@client, @guild_id, data[:member][:user], data[:member]) else guild.members[data[:user_id]] end end @session_id = data[:session_id] @deaf = data[:deaf] @mute = data[:mute] @self_deaf = data[:self_deaf] @self_mute = data[:self_mute] @self_stream = data[:self_stream] @self_video = data[:self_video] @suppress = data[:suppress] @request_to_speak_timestamp = data[:request_to_speak_timestamp] && Time.iso8601(data[:request_to_speak_timestamp]) end