From 8d7b77f665f8a7934d43a29df7804cfb5b67460b Mon Sep 17 00:00:00 2001 From: Ecolipsy Date: Tue, 23 Nov 2021 17:16:02 +0100 Subject: [PATCH] Add /apis --- index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.js b/index.js index bd61dcc..bb0fd34 100644 --- a/index.js +++ b/index.js @@ -107,6 +107,10 @@ client.on("ready", () => { { name: "cat", description: "Meow" + }, + { + name: "apis", + description: "Shows all APIs" } ]).then(cmds => { console.log("Finished loading all commands"); @@ -147,6 +151,15 @@ client.on("interactionCreate", (int) => { axios("https://api.thecatapi.com/v1/images/search").then((res) => { int.reply({embeds: [{title: "Meow", image: {url: res.data[0].url}, color: "#ec76fd"}]}); }); + } else if(int.commandName == "apis"){ + var apis = { + "Cat API": "https://api.thecatapi.com/v1/images/search" + }; + var apiArray = []; + Object.keys(apis).forEach(key => { + apiArray.push(key + ": " + apis[key]); + }); + int.reply("Here are all the APIs used in the bot: \n" + apiArray.join("\n")); } } });