Skip to content

Commit

Permalink
fix: skipping voice frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Dobrinskii committed Sep 11, 2024
1 parent da9e191 commit 36034f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
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

0 comments on commit 36034f2

Please sign in to comment.