mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
PLS WORK
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -94,7 +94,9 @@ class VoiceConnection extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_shutdown(e) {
|
_shutdown(e) {
|
||||||
console.log('being shut down! D:');
|
if (!this.ready) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
this.websocket._shutdown();
|
this.websocket._shutdown();
|
||||||
this.player._shutdown();
|
this.player._shutdown();
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class VoiceConnectionUDPClient extends EventEmitter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.udpSocket.on('error', (error, message) => {
|
this.udpSocket.on('error', (error, message) => {
|
||||||
|
console.log(error);
|
||||||
this.emit('error', { error, message });
|
this.emit('error', { error, message });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,19 +13,24 @@ class VoiceConnectionWebSocket extends EventEmitter {
|
|||||||
this.ws.onopen = () => this._onOpen();
|
this.ws.onopen = () => this._onOpen();
|
||||||
this.ws.onmessage = e => this._onMessage(e);
|
this.ws.onmessage = e => this._onMessage(e);
|
||||||
this.ws.onclose = e => this._onClose(e);
|
this.ws.onclose = e => this._onClose(e);
|
||||||
|
this.ws.onerror = e => this._onError(e);
|
||||||
|
this.ws.on('error', console.log);
|
||||||
this.heartbeat = null;
|
this.heartbeat = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
send(data) {
|
send(data) {
|
||||||
if (this.ws.readyState === WebSocket.OPEN) {
|
if (this.ws.readyState === WebSocket.OPEN) {
|
||||||
this.ws.send(JSON.stringify(data));
|
console.log('sending');
|
||||||
|
this.ws.send(JSON.stringify(data), function ack(error) {
|
||||||
|
if (error)
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_shutdown() {
|
_shutdown() {
|
||||||
if (this.ws) {
|
if (this.ws) {
|
||||||
this.ws.close();
|
this.ws.close();
|
||||||
this.ws = null;
|
|
||||||
}
|
}
|
||||||
clearInterval(this.heartbeat);
|
clearInterval(this.heartbeat);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ class FfmpegConverterEngine extends ConverterEngine {
|
|||||||
'-ss', '0',
|
'-ss', '0',
|
||||||
'pipe:1',
|
'pipe:1',
|
||||||
], { stdio: ['pipe', 'pipe', 'ignore'] });
|
], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||||
|
encoder.on('error', console.log);
|
||||||
|
encoder.stdin.on('error', console.log);
|
||||||
|
encoder.stdin.on('error', console.log);
|
||||||
return encoder;
|
return encoder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,14 +38,18 @@ class VoiceConnectionPlayer extends EventEmitter {
|
|||||||
if (streams) {
|
if (streams) {
|
||||||
if (streams.inputStream && streams.pcmConverter) {
|
if (streams.inputStream && streams.pcmConverter) {
|
||||||
try {
|
try {
|
||||||
if (streams.pcmConverter.stdin) {
|
streams.pcmConverter.on('error', console.log);
|
||||||
streams.pcmConverter.stdin.end();
|
streams.pcmConverter.stdin.on('error', console.log);
|
||||||
this.emit('debug', 'stream kill part 1/5 pass');
|
streams.pcmConverter.stdout.on('error', console.log);
|
||||||
}
|
streams.inputStream.stdout.on('error', console.log);
|
||||||
if (streams.pcmConverter.stdout.destroy) {
|
if (streams.pcmConverter.stdout.destroy) {
|
||||||
streams.pcmConverter.stdout.destroy();
|
streams.pcmConverter.stdout.destroy();
|
||||||
this.emit('debug', 'stream kill part 2/5 pass');
|
this.emit('debug', 'stream kill part 2/5 pass');
|
||||||
}
|
}
|
||||||
|
if (streams.pcmConverter.stdin) {
|
||||||
|
streams.pcmConverter.stdin.end();
|
||||||
|
this.emit('debug', 'stream kill part 1/5 pass');
|
||||||
|
}
|
||||||
if (streams.pcmConverter && streams.pcmConverter.kill) {
|
if (streams.pcmConverter && streams.pcmConverter.kill) {
|
||||||
streams.pcmConverter.kill('SIGINT');
|
streams.pcmConverter.kill('SIGINT');
|
||||||
this.emit('debug', 'stream kill part 3/5 pass');
|
this.emit('debug', 'stream kill part 3/5 pass');
|
||||||
@@ -59,7 +63,6 @@ class VoiceConnectionPlayer extends EventEmitter {
|
|||||||
this.emit('debug', 'stream kill part 5/5 pass');
|
this.emit('debug', 'stream kill part 5/5 pass');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,9 @@ client.on('message', msg => {
|
|||||||
msg.channel.guild.channels.get(chan).join()
|
msg.channel.guild.channels.get(chan).join()
|
||||||
.then(conn => {
|
.then(conn => {
|
||||||
msg.reply('done');
|
msg.reply('done');
|
||||||
|
const f = '04 Out of the Woods.m4a';
|
||||||
|
conn.player.playFile(`C:/Users/amish/Desktop/${f}`);
|
||||||
|
conn.player.on('debug', console.log);
|
||||||
})
|
})
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user