From fd579ae39ebc30d224984d27cdb9f8cae0f5e7f1 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 6 Oct 2018 13:24:14 +0200 Subject: [PATCH] Despacito --- commands/fun/despacito.js | 8 ++++---- json/despacito.json | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 json/despacito.json diff --git a/commands/fun/despacito.js b/commands/fun/despacito.js index 20c55c83..a8f9bfa9 100644 --- a/commands/fun/despacito.js +++ b/commands/fun/despacito.js @@ -1,4 +1,5 @@ const { Command } = require('discord.js-commando'); +const responseObject = require("../../json/despacito.json"); module.exports = class DespacitoCommand extends Command { constructor(client) { super(client, { @@ -10,9 +11,8 @@ module.exports = class DespacitoCommand extends Command { } async run(message) { - message.say("DES\nPA\nCITO"); - message.channel.send({files: ["https://images-eu.ssl-images-amazon.com/images/I/619fzjO1rmL._SS500.jpg"]}); - message.channel.send({files: ["https://cdn.dopl3r.com/memes_files/despacito-eS6Lm.jpg"]}); - message.say("https://www.youtube.com/watch?v=kJQP7kiw5Fk"); + const number = Object.keys(responseObject).length; + const despacitoNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1; + message.channel.send({files: [responseObject[despacitoNumber]]}); } }; \ No newline at end of file diff --git a/json/despacito.json b/json/despacito.json new file mode 100644 index 00000000..c5ee24fd --- /dev/null +++ b/json/despacito.json @@ -0,0 +1,9 @@ +{ + "1": "https://cdn.discordapp.com/attachments/475999813587173406/498088708210425866/image-50.jpg", + "2": "https://cdn.discordapp.com/attachments/475999813587173406/498088708872994818/image-29.png", + "3": "https://cdn.discordapp.com/attachments/475999813587173406/498088708872994821/magik-2.png", + "4": "https://cdn.discordapp.com/attachments/475999813587173406/498088709443289088/image-26.png", + "5": "https://cdn.discordapp.com/attachments/475999813587173406/498088709443289089/image-301.jpg", + "6": "https://cdn.discordapp.com/attachments/475999813587173406/498088709883953162/458da9a.jpg", + "7": "https://cdn.discordapp.com/attachments/349122704995254275/498086713026150400/despacito-eS6Lm.jpg" +} \ No newline at end of file