Add /apis

This commit is contained in:
Ecolipsy 2021-11-23 17:16:02 +01:00
parent 8fa826da1f
commit 8d7b77f665

View file

@ -107,6 +107,10 @@ client.on("ready", () => {
{ {
name: "cat", name: "cat",
description: "Meow" description: "Meow"
},
{
name: "apis",
description: "Shows all APIs"
} }
]).then(cmds => { ]).then(cmds => {
console.log("Finished loading all commands"); console.log("Finished loading all commands");
@ -147,6 +151,15 @@ client.on("interactionCreate", (int) => {
axios("https://api.thecatapi.com/v1/images/search").then((res) => { axios("https://api.thecatapi.com/v1/images/search").then((res) => {
int.reply({embeds: [{title: "Meow", image: {url: res.data[0].url}, color: "#ec76fd"}]}); 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"));
} }
} }
}); });