@@ -44,6 +44,22 @@ class VoiceFactory {
44
44
this . updateSelf ( ) ;
45
45
}
46
46
}
47
+ disconect ( ) {
48
+ if ( ! this . curChan ) return ;
49
+ this . curChan = null ;
50
+ this . curGuild = null ;
51
+ this . handleGateway ( {
52
+ op : 4 ,
53
+ d : {
54
+ guild_id : this . curGuild ,
55
+ channel_id : this . curChan ,
56
+ self_mute : this . imute ,
57
+ self_deaf : false ,
58
+ self_video : false ,
59
+ flags : 3 ,
60
+ } ,
61
+ } ) ;
62
+ }
47
63
updateSelf ( ) {
48
64
if ( this . currentVoice && this . currentVoice . open ) {
49
65
this . handleGateway ( {
@@ -59,8 +75,8 @@ class VoiceFactory {
59
75
} ) ;
60
76
}
61
77
}
62
- curGuild ? : string ;
63
- curChan ? : string ;
78
+ curGuild : string | null = null ;
79
+ curChan : string | null = null ;
64
80
joinVoice ( channelId : string , guildId : string , self_mute = false ) {
65
81
const voice = this . voiceChannels . get ( channelId ) ;
66
82
this . mute = self_mute ;
@@ -152,7 +168,7 @@ class Voice {
152
168
this . ws . send ( JSON . stringify ( { op : 3 , d : 10 } ) ) ;
153
169
}
154
170
}
155
- readonly users = new Map < number , string > ( ) ;
171
+ users = new Map < number , string > ( ) ;
156
172
readonly speakingMap = new Map < string , number > ( ) ;
157
173
onSpeakingChange = ( _userid : string , _speaking : number ) => { } ;
158
174
disconnect ( userid : string ) {
@@ -826,9 +842,17 @@ a=rtcp-mux\r`;
826
842
this . micTrack ?. stop ( ) ;
827
843
this . micTrack = undefined ;
828
844
this . micTrack = undefined ;
845
+ this . mic = undefined ;
829
846
this . off = undefined ;
830
847
this . counter = undefined ;
831
848
this . offer = undefined ;
849
+ this . senders = new Set ( ) ;
850
+ this . recivers = new Set ( ) ;
851
+ this . ssrcMap = new Map ( ) ;
852
+ this . fingerprint = undefined ;
853
+ this . users = new Map ( ) ;
854
+ this . owner . disconect ( ) ;
855
+ console . log ( this ) ;
832
856
}
833
857
}
834
858
export { Voice , VoiceFactory } ;
0 commit comments