This commit is contained in:
Raven Scott 2021-07-02 13:38:41 -04:00
parent 75a3a414bf
commit 95d8c13bcb

View File

@ -14,7 +14,7 @@ exports.run = async (bot, message, args, functions) => {
var url = urlcmd var url = urlcmd
if (url != "stop") { if (url != "stop") {
var name = Math.floor(Math.random() * 999999); var name = Math.floor(Math.random() * 999999);
var callback = function(exitCodes) { var callback = function (exitCodes) {
console.log('Called Back - Converting....'); console.log('Called Back - Converting....');
let midiBuffer = fs.readFileSync('./midifiles/' + name + ".mid"); let midiBuffer = fs.readFileSync('./midifiles/' + name + ".mid");
@ -33,20 +33,20 @@ exports.run = async (bot, message, args, functions) => {
const now = new Date(); const now = new Date();
message.channel.send({ message.channel.send({
"embed": { "embed": {
"color": 2899536, "color": 2899536,
"footer": { "footer": {
"text": date.format(now, 'MM/DD/YYYY hh:mm:ss') "text": date.format(now, 'MM/DD/YYYY hh:mm:ss')
}, },
"fields": [ "fields": [
{ {
"name": "Midi Sound Generator", "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" , "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 "inline": true
} }
] ]
} }
}); });
const dispatcher = connection.play('/var/www/html/midi/' + name + ".wav"); const dispatcher = connection.play('/var/www/html/midi/' + name + ".wav");
dispatcher.on("end", end => { dispatcher.on("end", end => {
@ -64,27 +64,27 @@ exports.run = async (bot, message, args, functions) => {
.catch(console.log); .catch(console.log);
} else { } else {
const date = require('date-and-time'); const date = require('date-and-time');
const now = new Date(); const now = new Date();
message.channel.send({ message.channel.send({
"embed": { "embed": {
"color": 2899536, "color": 2899536,
"footer": { "footer": {
"text": date.format(now, 'MM/DD/YYYY hh:mm:ss') "text": date.format(now, 'MM/DD/YYYY hh:mm:ss')
}, },
"fields": [ "fields": [
{ {
"name": "Midi Sound Generator", "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." , "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 "inline": true
}
]
} }
] });
} }
});
}
} }
@ -113,12 +113,11 @@ exports.conf = {
guildOnly: false, guildOnly: false,
aliases: [''], aliases: [''],
permLevel: "User" permLevel: "User"
}; };
exports.help = { exports.help = {
name: "midi", name: "midi",
category: "Troll", category: "Troll",
description: "", description: "Play a midi file from a URL - Download the wav or Listen in VC",
usage: "midi" usage: "midi"
}; };