mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-11 01:22:48 +00:00
fix: attempt fixing voice disconnections
This commit is contained in:
@@ -153,12 +153,18 @@ func (conn *AudioConnection) summon(m *discordgo.MessageCreate) {
|
||||
for _, vs := range g.VoiceStates {
|
||||
if vs.UserID == m.Author.ID {
|
||||
|
||||
conn.VoiceConnection, err = conn.Session.ChannelVoiceJoin(g.ID, vs.ChannelID, false, false)
|
||||
_, err = conn.Session.ChannelVoiceJoin(g.ID, vs.ChannelID, false, false)
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
if _, ok := conn.Session.VoiceConnections[c.GuildID]; ok {
|
||||
conn.VoiceConnection = conn.Session.VoiceConnections[c.GuildID]
|
||||
} else {
|
||||
log.Error("Voice connection not found on discord object")
|
||||
return
|
||||
}
|
||||
|
||||
// set the current channel
|
||||
conn.CurrentChannel = c
|
||||
|
||||
Reference in New Issue
Block a user