Class: Discordrb::Events::VoiceStateUpdateEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/events/voice_state_update.rb

Overview

Event raised when a user’s voice state updates

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ VoiceStateUpdateEvent

Returns a new instance of VoiceStateUpdateEvent.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/discordrb/events/voice_state_update.rb', line 18

def initialize(data, 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']
  @user = bot.user(data['user_id'].to_i)
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



16
17
18
# File 'lib/discordrb/events/voice_state_update.rb', line 16

def channel
  @channel
end

#deafObject (readonly)

Returns the value of attribute deaf.



14
15
16
# File 'lib/discordrb/events/voice_state_update.rb', line 14

def deaf
  @deaf
end

#muteObject (readonly)

Returns the value of attribute mute.



13
14
15
# File 'lib/discordrb/events/voice_state_update.rb', line 13

def mute
  @mute
end

#self_deafObject (readonly)

Returns the value of attribute self_deaf.



12
13
14
# File 'lib/discordrb/events/voice_state_update.rb', line 12

def self_deaf
  @self_deaf
end

#self_muteObject (readonly)

Returns the value of attribute self_mute.



11
12
13
# File 'lib/discordrb/events/voice_state_update.rb', line 11

def self_mute
  @self_mute
end

#serverObject (readonly)

Returns the value of attribute server.



15
16
17
# File 'lib/discordrb/events/voice_state_update.rb', line 15

def server
  @server
end

#session_idObject (readonly)

Returns the value of attribute session_id.



10
11
12
# File 'lib/discordrb/events/voice_state_update.rb', line 10

def session_id
  @session_id
end

#suppressObject (readonly)

Returns the value of attribute suppress.



9
10
11
# File 'lib/discordrb/events/voice_state_update.rb', line 9

def suppress
  @suppress
end

#tokenObject (readonly)

Returns the value of attribute token.



8
9
10
# File 'lib/discordrb/events/voice_state_update.rb', line 8

def token
  @token
end

#userObject (readonly)

Returns the value of attribute user.



7
8
9
# File 'lib/discordrb/events/voice_state_update.rb', line 7

def user
  @user
end