From af1ae7d4f18ffe8aa413ded6be7668c5504df2f0 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 19 Feb 2020 23:33:23 +0100 Subject: [PATCH] --raw option --- commands/fun/midify.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/commands/fun/midify.js b/commands/fun/midify.js index 71e1c706..92ad8656 100644 --- a/commands/fun/midify.js +++ b/commands/fun/midify.js @@ -14,10 +14,15 @@ class midifyCommand extends Command { { id: 'link', type: 'string', + }, + { + id: 'raw', + type: 'flag', + flag: '--raw' } ], description: { - content: 'Transform the audio into midi', + content: 'Transform the audio into midi --raw to get the .mid file', usage: '[link to video/music/whatever you want to be midi]', examples: ['https://www.youtube.com/watch?v=kXYiU_JCYtU'] } @@ -66,6 +71,17 @@ class midifyCommand extends Command { // wav to midi exec(`waon -i ${input2} -o ${output}`) .then(() => { + + if (args.raw) { + loadingmsg.delete(); + return message.channel.send({files: [output]}) + .catch(err => { + console.error(err); + loadingmsg.delete(); + return message.channel.send('On no! an error just occured! perhaps the file is too big?'); + }); + } + // midi to mp3 so we can listen from discord exec(`timidity ${output} -Ow -o - | ffmpeg -i - -acodec libmp3lame -ab 64k ${output2}`) .then(() => {