From 95d8c13bcb8e770cc8d04d6f918bd669aad29947 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Fri, 2 Jul 2021 13:38:41 -0400 Subject: [PATCH] clean up --- commands/Utilities/midi.js | 77 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/commands/Utilities/midi.js b/commands/Utilities/midi.js index 856a5af..2624647 100644 --- a/commands/Utilities/midi.js +++ b/commands/Utilities/midi.js @@ -14,7 +14,7 @@ exports.run = async (bot, message, args, functions) => { var url = urlcmd if (url != "stop") { var name = Math.floor(Math.random() * 999999); - var callback = function(exitCodes) { + var callback = function (exitCodes) { console.log('Called Back - Converting....'); let midiBuffer = fs.readFileSync('./midifiles/' + name + ".mid"); @@ -33,20 +33,20 @@ exports.run = async (bot, message, args, functions) => { const now = new Date(); message.channel.send({ "embed": { - "color": 2899536, - "footer": { - "text": date.format(now, 'MM/DD/YYYY hh:mm:ss') - }, - "fields": [ - - { - "name": "Midi Sound Generator", - "value": "Here is the sound file: \n https://midi.codingvm.codes/" + name + ".wav \n It should also be playing within the voice channel" , - "inline": true - } - ] + "color": 2899536, + "footer": { + "text": date.format(now, 'MM/DD/YYYY hh:mm:ss') + }, + "fields": [ + + { + "name": "Midi Sound Generator", + "value": "Here is the sound file: \n https://midi.codingvm.codes/" + name + ".wav \n It should also be playing within the voice channel", + "inline": true + } + ] } - }); + }); const dispatcher = connection.play('/var/www/html/midi/' + name + ".wav"); dispatcher.on("end", end => { @@ -64,27 +64,27 @@ exports.run = async (bot, message, args, functions) => { .catch(console.log); - } else { + } else { - const date = require('date-and-time'); - const now = new Date(); - message.channel.send({ - "embed": { - "color": 2899536, - "footer": { - "text": date.format(now, 'MM/DD/YYYY hh:mm:ss') - }, - "fields": [ - - { - "name": "Midi Sound Generator", - "value": "Here is the sound file: \n https://midi.codingvm.codes/" + name + ".wav \n If you join voice, I can also play it when finished." , - "inline": true + const date = require('date-and-time'); + const now = new Date(); + message.channel.send({ + "embed": { + "color": 2899536, + "footer": { + "text": date.format(now, 'MM/DD/YYYY hh:mm:ss') + }, + "fields": [ + + { + "name": "Midi Sound Generator", + "value": "Here is the sound file: \n https://midi.codingvm.codes/" + name + ".wav \n If you join voice, I can also play it when finished.", + "inline": true + } + ] } - ] - } - }); - } + }); + } } @@ -113,12 +113,11 @@ exports.conf = { guildOnly: false, aliases: [''], permLevel: "User" - }; - - exports.help = { +}; + +exports.help = { name: "midi", category: "Troll", - description: "", + description: "Play a midi file from a URL - Download the wav or Listen in VC", usage: "midi" - }; - \ No newline at end of file +};