Class: Discordrb::Events::VoiceStateUpdateEvent
- Defined in:
- lib/discordrb/events/voice_state_update.rb
Overview
Event raised when a user's voice state updates
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#deaf ⇒ Object
readonly
Returns the value of attribute deaf.
-
#mute ⇒ Object
readonly
Returns the value of attribute mute.
-
#old_channel ⇒ Channel?
readonly
The old channel this user was on, or nil if the user is newly joining voice.
-
#self_deaf ⇒ Object
readonly
Returns the value of attribute self_deaf.
-
#self_mute ⇒ Object
readonly
Returns the value of attribute self_mute.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
-
#suppress ⇒ Object
readonly
Returns the value of attribute suppress.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Event
Instance Method Summary collapse
-
#initialize(data, old_channel_id, bot) ⇒ VoiceStateUpdateEvent
constructor
A new instance of VoiceStateUpdateEvent.
Constructor Details
#initialize(data, old_channel_id, bot) ⇒ VoiceStateUpdateEvent
Returns a new instance of VoiceStateUpdateEvent.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/discordrb/events/voice_state_update.rb', line 14 def initialize(data, old_channel_id, bot) @bot = bot @token = data['token'] @suppress = data['suppress'] @session_id = data['session_id'] @self_mute = data['self_mute'] @self_deaf = data['self_deaf'] @mute = data['mute'] @deaf = data['deaf'] @server = bot.server(data['guild_id'].to_i) return unless @server @channel = bot.channel(data['channel_id'].to_i) if data['channel_id'] @old_channel = bot.channel(old_channel_id) if old_channel_id @user = bot.user(data['user_id'].to_i) end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def channel @channel end |
#deaf ⇒ Object (readonly)
Returns the value of attribute deaf.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def deaf @deaf end |
#mute ⇒ Object (readonly)
Returns the value of attribute mute.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def mute @mute end |
#old_channel ⇒ Channel? (readonly)
Returns the old channel this user was on, or nil if the user is newly joining voice.
12 13 14 |
# File 'lib/discordrb/events/voice_state_update.rb', line 12 def old_channel @old_channel end |
#self_deaf ⇒ Object (readonly)
Returns the value of attribute self_deaf.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def self_deaf @self_deaf end |
#self_mute ⇒ Object (readonly)
Returns the value of attribute self_mute.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def self_mute @self_mute end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def server @server end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def session_id @session_id end |
#suppress ⇒ Object (readonly)
Returns the value of attribute suppress.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def suppress @suppress end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def token @token end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
9 10 11 |
# File 'lib/discordrb/events/voice_state_update.rb', line 9 def user @user end |