mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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) {
|
||||
console.log('being shut down! D:');
|
||||
if (!this.ready) {
|
||||
return;
|
||||
}
|
||||
this.ready = false;
|
||||
this.websocket._shutdown();
|
||||
this.player._shutdown();
|
||||
|
||||
@@ -74,6 +74,7 @@ class VoiceConnectionUDPClient extends EventEmitter {
|
||||
});
|
||||
|
||||
this.udpSocket.on('error', (error, message) => {
|
||||
console.log(error);
|
||||
this.emit('error', { error, message });
|
||||
});
|
||||
|
||||
|
||||
@@ -13,19 +13,24 @@ class VoiceConnectionWebSocket extends EventEmitter {
|
||||
this.ws.onopen = () => this._onOpen();
|
||||
this.ws.onmessage = e => this._onMessage(e);
|
||||
this.ws.onclose = e => this._onClose(e);
|
||||
this.ws.onerror = e => this._onError(e);
|
||||
this.ws.on('error', console.log);
|
||||
this.heartbeat = null;
|
||||
}
|
||||
|
||||
send(data) {
|
||||
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() {
|
||||
if (this.ws) {
|
||||
this.ws.close();
|
||||
this.ws = null;
|
||||
}
|
||||
clearInterval(this.heartbeat);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ class FfmpegConverterEngine extends ConverterEngine {
|
||||
'-ss', '0',
|
||||
'pipe:1',
|
||||
], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||
encoder.on('error', console.log);
|
||||
encoder.stdin.on('error', console.log);
|
||||
encoder.stdin.on('error', console.log);
|
||||
return encoder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,14 +38,18 @@ class VoiceConnectionPlayer extends EventEmitter {
|
||||
if (streams) {
|
||||
if (streams.inputStream && streams.pcmConverter) {
|
||||
try {
|
||||
if (streams.pcmConverter.stdin) {
|
||||
streams.pcmConverter.stdin.end();
|
||||
this.emit('debug', 'stream kill part 1/5 pass');
|
||||
}
|
||||
streams.pcmConverter.on('error', console.log);
|
||||
streams.pcmConverter.stdin.on('error', console.log);
|
||||
streams.pcmConverter.stdout.on('error', console.log);
|
||||
streams.inputStream.stdout.on('error', console.log);
|
||||
if (streams.pcmConverter.stdout.destroy) {
|
||||
streams.pcmConverter.stdout.destroy();
|
||||
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) {
|
||||
streams.pcmConverter.kill('SIGINT');
|
||||
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');
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +205,9 @@ client.on('message', msg => {
|
||||
msg.channel.guild.channels.get(chan).join()
|
||||
.then(conn => {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user