Send message when error occures
This commit is contained in:
parent
53553cb330
commit
1ef5ec1140
2 changed files with 16 additions and 4 deletions
|
@ -53,7 +53,10 @@ class audio2imageCommand extends Command {
|
||||||
.format('s16le')
|
.format('s16le')
|
||||||
.audioCodec('pcm_s16le')
|
.audioCodec('pcm_s16le')
|
||||||
.output(`${os.tmpdir()}/${message.id}1.sw`)
|
.output(`${os.tmpdir()}/${message.id}1.sw`)
|
||||||
.on('error', (err, stdout, stderr) => console.error(`${err}\n${stdout}\n${stderr}`))
|
.on('error', (err, stdout, stderr) => {
|
||||||
|
console.error(`${err}\n${stdout}\n${stderr}`);
|
||||||
|
return message.channel.send('Uh oh, an error has occured!');
|
||||||
|
})
|
||||||
.on('end', () => {
|
.on('end', () => {
|
||||||
ffmpeg()
|
ffmpeg()
|
||||||
.input(`${os.tmpdir()}/${message.id}1.sw`)
|
.input(`${os.tmpdir()}/${message.id}1.sw`)
|
||||||
|
@ -63,7 +66,10 @@ class audio2imageCommand extends Command {
|
||||||
.inputFormat('rawvideo')
|
.inputFormat('rawvideo')
|
||||||
.frames('1')
|
.frames('1')
|
||||||
.output(`${os.tmpdir()}/a2i${message.id}.png`)
|
.output(`${os.tmpdir()}/a2i${message.id}.png`)
|
||||||
.on('error', (err, stdout, stderr) => console.error(`${err}\n${stdout}\n${stderr}`))
|
.on('error', (err, stdout, stderr) => {
|
||||||
|
console.error(`${err}\n${stdout}\n${stderr}`);
|
||||||
|
return message.channel.send('Uh oh, an error has occured!');
|
||||||
|
})
|
||||||
.on('end', () => {
|
.on('end', () => {
|
||||||
console.log('finished');
|
console.log('finished');
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
|
|
|
@ -44,7 +44,10 @@ class image2audioCommand extends Command {
|
||||||
ffmpeg(`${os.tmpdir()}/${message.id}.png`)
|
ffmpeg(`${os.tmpdir()}/${message.id}.png`)
|
||||||
.format('rawvideo')
|
.format('rawvideo')
|
||||||
.output(`${os.tmpdir()}/${message.id}1.png`)
|
.output(`${os.tmpdir()}/${message.id}1.png`)
|
||||||
.on('error', (err, stdout, stderr) => console.error(`${err}\n${stdout}\n${stderr}`))
|
.on('error', (err, stdout, stderr) => {
|
||||||
|
console.error(`${err}\n${stdout}\n${stderr}`);
|
||||||
|
return message.channel.send('Uh oh, an error has occured!');
|
||||||
|
})
|
||||||
.on('end', () => {
|
.on('end', () => {
|
||||||
ffmpeg()
|
ffmpeg()
|
||||||
.audioBitrate(44100)
|
.audioBitrate(44100)
|
||||||
|
@ -52,7 +55,10 @@ class image2audioCommand extends Command {
|
||||||
.input(`${os.tmpdir()}/${message.id}1.png`)
|
.input(`${os.tmpdir()}/${message.id}1.png`)
|
||||||
.inputFormat('s16le')
|
.inputFormat('s16le')
|
||||||
.output(`${os.tmpdir()}/i2a_${message.id}.wav`)
|
.output(`${os.tmpdir()}/i2a_${message.id}.wav`)
|
||||||
.on('error', (err, stdout, stderr) => console.error(`${err}\n${stdout}\n${stderr}`))
|
.on('error', (err, stdout, stderr) => {
|
||||||
|
console.error(`${err}\n${stdout}\n${stderr}`);
|
||||||
|
return message.channel.send('Uh oh, an error has occured!');
|
||||||
|
})
|
||||||
.on('end', () => {
|
.on('end', () => {
|
||||||
console.log('finished');
|
console.log('finished');
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
|
|
Loading…
Reference in a new issue