From 6af05bcc313ade9beb53ffdc230a8eef4f4f4d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sat, 8 Sep 2018 20:34:03 +0200 Subject: [PATCH] Despacito will now send random vid from randVid.json --- commands/fun/despacito.js | 7 +++++-- randVid.json | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 randVid.json diff --git a/commands/fun/despacito.js b/commands/fun/despacito.js index 1bec58b0..75555fec 100644 --- a/commands/fun/despacito.js +++ b/commands/fun/despacito.js @@ -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]); + } }; \ No newline at end of file diff --git a/randVid.json b/randVid.json new file mode 100644 index 00000000..8b4a6f1e --- /dev/null +++ b/randVid.json @@ -0,0 +1,4 @@ +{ + "1": "https://twitter.com/i/status/1037932315727618048", + "2": "https://www.youtube.com/watch?v=W3GrSMYbkBE" +} \ No newline at end of file