Don't stomp on VoiceConnection if exists already
This allows you to enable voice debugging prior to joining a voice channel.
This commit is contained in:
parent
1d2d93a7b5
commit
a00f64aa86
1 changed files with 8 additions and 10 deletions
18
wsapi.go
18
wsapi.go
|
@ -519,18 +519,16 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new voice session
|
if voice == nil {
|
||||||
// TODO review what all these things are for....
|
voice = &VoiceConnection{}
|
||||||
voice = &VoiceConnection{
|
s.VoiceConnections[gID] = voice
|
||||||
GuildID: gID,
|
|
||||||
ChannelID: cID,
|
|
||||||
deaf: deaf,
|
|
||||||
mute: mute,
|
|
||||||
session: s,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store voice in VoiceConnections map for this GuildID
|
voice.GuildID = gID
|
||||||
s.VoiceConnections[gID] = voice
|
voice.ChannelID = cID
|
||||||
|
voice.deaf = deaf
|
||||||
|
voice.mute = mute
|
||||||
|
voice.session = s
|
||||||
|
|
||||||
// Send the request to Discord that we want to join the voice channel
|
// Send the request to Discord that we want to join the voice channel
|
||||||
data := voiceChannelJoinOp{4, voiceChannelJoinData{&gID, &cID, mute, deaf}}
|
data := voiceChannelJoinOp{4, voiceChannelJoinData{&gID, &cID, mute, deaf}}
|
||||||
|
|
Loading…
Reference in a new issue