Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on session.ChannelVoiceJoin in deafened=false mode #1161

Closed
khodand opened this issue Apr 17, 2022 · 1 comment · Fixed by #1166
Closed

Panic on session.ChannelVoiceJoin in deafened=false mode #1161

khodand opened this issue Apr 17, 2022 · 1 comment · Fixed by #1166

Comments

@khodand
Copy link
Contributor

khodand commented Apr 17, 2022


goroutine 89 [running]:
github.com/bwmarrin/discordgo.(*VoiceConnection).opusReceiver(0xc0004154a0, 0xc000092130, 0xc0000949c0, 0xc000176360)
        ***/vendor/github.com/bwmarrin/discordgo/voice.go:837 +0x59a
created by github.com/bwmarrin/discordgo.(*VoiceConnection).onEvent
       ***/vendor/github.com/bwmarrin/discordgo/voice.go:441 +0x6d8

I'm creating a music bot. When bot catch's the message event, it is initializing the voice connection. The bot connects to the voice channel, and after that it can accidentally throw a panic.

Connnecting:

// (s *discordgo.Session, m *discordgo.MessageCreate)
        guild, err := s.State.Guild(m.GuildID)
	if err != nil {
		return "", err
	}
	id := ""
	for _, voiceState := range guild.VoiceStates {
		if voiceState.UserID == m.Author.ID {
			id = voiceState.ChannelID
			break
		}
	}
	c.session.ChannelVoiceJoin(m.GuildID, id, false, false)
@khodand khodand changed the title Random panic after connection Random panic after c.session.ChannelVoiceJoin Apr 17, 2022
@khodand khodand changed the title Random panic after c.session.ChannelVoiceJoin Random panic after session.ChannelVoiceJoin Apr 17, 2022
@khodand khodand closed this as completed Apr 17, 2022
@khodand
Copy link
Contributor Author

khodand commented Apr 20, 2022

session.Open() was successful

There seems to be a panic when calling ChannelVoiceJoin()
The (s *Session) ChannelVoiceJoinManual calls for a s.wsConn, but s.wsConn == nil

runtime.fatalpanic (panic.go:1271) runtime
runtime.gopanic (panic.go:1147) runtime
runtime.panicmem (panic.go:221) runtime
runtime.sigpanic (signal_windows.go:254) runtime
websocket.(*Conn).beginMessage (conn.go:479) github.com/gorilla/websocket
websocket.(*Conn).NextWriter (conn.go:520) github.com/gorilla/websocket
websocket.(*Conn).WriteJSON (json.go:24) github.com/gorilla/websocket
discordgo.(*Session).ChannelVoiceJoinManual (wsapi.go:722) github.com/bwmarrin/discordgo
discordgo.(*Session).ChannelVoiceJoin (wsapi.go:684) github.com/bwmarrin/discordgo

@khodand khodand reopened this Apr 20, 2022
@khodand khodand changed the title Random panic after session.ChannelVoiceJoin Panic on session.ChannelVoiceJoin Apr 20, 2022
@khodand khodand changed the title Panic on session.ChannelVoiceJoin Panic on session.ChannelVoiceJoin in deafened=false mode Apr 22, 2022
@FedorLap2006 FedorLap2006 linked a pull request Apr 28, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant