Despacito will now send random vid from randVid.json

This commit is contained in:
Loïc Bersier 2018-09-08 20:34:03 +02:00
parent 3be13d9d03
commit 6af05bcc31
2 changed files with 9 additions and 2 deletions

View file

@ -1,4 +1,5 @@
const { Command } = require('discord.js-commando');
const responseObject = require("../../randVid.json");
module.exports = class DespacitoCommand extends Command {
constructor(client) {
super(client, {
@ -10,6 +11,8 @@ module.exports = class DespacitoCommand extends Command {
}
run(message) {
return message.say('https://www.youtube.com/watch?v=W3GrSMYbkBE');
}
const number = 2;
const vidNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
message.channel.send(responseObject[vidNumber]);
}
};

4
randVid.json Normal file
View file

@ -0,0 +1,4 @@
{
"1": "https://twitter.com/i/status/1037932315727618048",
"2": "https://www.youtube.com/watch?v=W3GrSMYbkBE"
}