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

Connecting, disconnecting and then reconnecting to VoiceChannel results in panic writing to closed channel #1035

Closed
alex-broad opened this issue Nov 21, 2021 · 1 comment · Fixed by #1166

Comments

@alex-broad
Copy link

Hi,

I've mostly cribbed the example code for your voice-receive example and embedded it in a bot to allow me to control it.. but despite following the example where you close(*discordgo.VoiceConnection.OpusRecv) and then *discordgo.VoiceConnection.Close() (and I then s.ChannelVoiceJoinManual(r.Guild.ID, "", true, false) to make the bot leave the voice channel... there isn't an explicit ChannelVoiceLeave() it seems?)

On starting speaking, it panics:

panic: send on closed channel

goroutine 70 [running]:
github.com/bwmarrin/discordgo.(*VoiceConnection).opusReceiver(0xc0000de420, 0xc000366088, 0xc0000a3b00, 0xc0004ea480)
        /home/azekeil/go/pkg/mod/github.com/bwmarrin/discordgo@v0.23.2/voice.go:840 +0x2d8
created by github.com/bwmarrin/discordgo.(*VoiceConnection).onEvent
        /home/azekeil/go/pkg/mod/github.com/bwmarrin/discordgo@v0.23.2/voice.go:441 +0x6d8
exit status 2

Have I done something wrong?

Thanks in advance, appreciate your library!

@la4zen
Copy link

la4zen commented Apr 28, 2022

I have same problem too.

@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.

2 participants