From e8b6d328faf45b42e960342d4b3b2d346fa8a94c Mon Sep 17 00:00:00 2001 From: kry008 Date: Thu, 23 May 2024 14:12:07 +0200 Subject: [PATCH] =?UTF-8?q?duck=F0=9F=A6=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/duck.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 commands/duck.js diff --git a/commands/duck.js b/commands/duck.js new file mode 100644 index 0000000..b2a6d8b --- /dev/null +++ b/commands/duck.js @@ -0,0 +1,29 @@ +//https://random-d.uk/api/v2/random +function returnDuck() { + return fetch('https://random-d.uk/api/v2/random') + .then(response => response.json()) + .then(data => data.url); +} +module.exports = { + name: 'duck', + description: 'Get a random duck picture', + help: 'Get a random duck picture', + options: [], + slash: true, + text: true, + admin: false, + requireKick: false, + requireBan: false, + canBeUsedInDm: true, + premium: false, + contexts: ['GUILD_TEXT', 'GUILD_VOICE', 'DM'], + integration_types: [0,1], + execute: async (message, args) => { + const duck = await returnDuck(); + message.channel.send(duck); + }, + executeSlash: async interaction => { + const duck = await returnDuck(); + interaction.reply(duck); + }, +}; \ No newline at end of file