Add /apis
This commit is contained in:
parent
8fa826da1f
commit
8d7b77f665
1 changed files with 13 additions and 0 deletions
13
index.js
13
index.js
|
@ -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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue