v5.3.14
Waiting for proper fix...
This commit is contained in:
parent
d7ce7acb22
commit
6f189cc523
2 changed files with 17 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "discord-player-play-dl",
|
"name": "discord-player-play-dl",
|
||||||
"version": "5.3.13",
|
"version": "5.3.14",
|
||||||
"description": "Complete framework to facilitate music commands using discord.js and play-dl",
|
"description": "Complete framework to facilitate music commands using discord.js and play-dl",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
StreamType,
|
StreamType,
|
||||||
VoiceConnection,
|
VoiceConnection,
|
||||||
VoiceConnectionStatus,
|
VoiceConnectionStatus,
|
||||||
VoiceConnectionDisconnectReason
|
VoiceConnectionDisconnectReason,
|
||||||
|
VoiceConnectionState
|
||||||
} from "@discordjs/voice";
|
} from "@discordjs/voice";
|
||||||
import { StageChannel, VoiceChannel } from "discord.js";
|
import { StageChannel, VoiceChannel } from "discord.js";
|
||||||
import { Duplex, Readable } from "stream";
|
import { Duplex, Readable } from "stream";
|
||||||
|
@ -68,7 +69,20 @@ class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
||||||
*/
|
*/
|
||||||
this.paused = false;
|
this.paused = false;
|
||||||
|
|
||||||
this.voiceConnection.on("stateChange", async (_, newState) => {
|
this.voiceConnection.on("stateChange", async (oldState, newState) => {
|
||||||
|
// oh no, fix no work
|
||||||
|
const oldNetworking = Reflect.get(oldState, "networking");
|
||||||
|
const newNetworking = Reflect.get(newState, "networking");
|
||||||
|
|
||||||
|
const networkStateChangeHandler = (_: VoiceConnectionState, newNetworkState: VoiceConnectionState) => {
|
||||||
|
const newUdp = Reflect.get(newNetworkState, "udp");
|
||||||
|
clearInterval(newUdp?.keepAliveInterval);
|
||||||
|
};
|
||||||
|
|
||||||
|
oldNetworking?.off("stateChange", networkStateChangeHandler);
|
||||||
|
newNetworking?.on("stateChange", networkStateChangeHandler);
|
||||||
|
// temp fix end
|
||||||
|
|
||||||
if (newState.status === VoiceConnectionStatus.Disconnected) {
|
if (newState.status === VoiceConnectionStatus.Disconnected) {
|
||||||
if (newState.reason === VoiceConnectionDisconnectReason.WebSocketClose && newState.closeCode === 4014) {
|
if (newState.reason === VoiceConnectionDisconnectReason.WebSocketClose && newState.closeCode === 4014) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue