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

Proposal to fix skipping voice frames #1568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion voice.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ func (v *VoiceConnection) reconnect() {

v.log(LogInformational, "trying to reconnect to channel %s", v.ChannelID)

_, err := v.session.ChannelVoiceJoin(v.GuildID, v.ChannelID, v.mute, v.deaf)
_, err := v.session.ChannelVoiceJoin(v.GuildID, v.ChannelID, v.mute, v.deaf, nil)
if err == nil {
v.log(LogInformational, "successfully reconnected to channel %s", v.ChannelID)
return
Expand Down
21 changes: 12 additions & 9 deletions wsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,11 @@ type voiceChannelJoinOp struct {

// ChannelVoiceJoin joins the session user to a voice channel.
//
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *VoiceConnection, err error) {
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool, h VoiceSpeakingUpdateHandler) (voice *VoiceConnection, err error) {

s.log(LogInformational, "called")

Expand All @@ -696,6 +696,9 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi

if voice == nil {
voice = &VoiceConnection{}
if h != nil {
voice.AddHandler(h)
}
s.Lock()
s.VoiceConnections[gID] = voice
s.Unlock()
Expand Down Expand Up @@ -729,10 +732,10 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
//
// This should only be used when the VoiceServerUpdate will be intercepted and used elsewhere.
//
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join, leave empty to disconnect.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join, leave empty to disconnect.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
func (s *Session) ChannelVoiceJoinManual(gID, cID string, mute, deaf bool) (err error) {

s.log(LogInformational, "called")
Expand Down