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')
|
||||
.audioCodec('pcm_s16le')
|
||||
.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', () => {
|
||||
ffmpeg()
|
||||
.input(`${os.tmpdir()}/${message.id}1.sw`)
|
||||
|
@ -63,7 +66,10 @@ class audio2imageCommand extends Command {
|
|||
.inputFormat('rawvideo')
|
||||
.frames('1')
|
||||
.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', () => {
|
||||
console.log('finished');
|
||||
loadingmsg.delete();
|
||||
|
|
|
@ -44,7 +44,10 @@ class image2audioCommand extends Command {
|
|||
ffmpeg(`${os.tmpdir()}/${message.id}.png`)
|
||||
.format('rawvideo')
|
||||
.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', () => {
|
||||
ffmpeg()
|
||||
.audioBitrate(44100)
|
||||
|
@ -52,7 +55,10 @@ class image2audioCommand extends Command {
|
|||
.input(`${os.tmpdir()}/${message.id}1.png`)
|
||||
.inputFormat('s16le')
|
||||
.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', () => {
|
||||
console.log('finished');
|
||||
loadingmsg.delete();
|
||||
|
|
Loading…
Reference in a new issue