diff --git a/src/api/cat/index.js b/src/api/cat/index.js new file mode 100644 index 0000000..322c610 --- /dev/null +++ b/src/api/cat/index.js @@ -0,0 +1,13 @@ +import axios from 'axios'; + +const cat = async () => { + return await axios.get('https://aws.random.cat/meow') + .then((res) => { + return res.data.file; + }) + .catch((err) => { + console.log(err); + }); +}; + +export default { name: 'cat', execute: cat }; diff --git a/src/commands/cat/index.js b/src/commands/cat/index.js new file mode 100644 index 0000000..9354b5e --- /dev/null +++ b/src/commands/cat/index.js @@ -0,0 +1,13 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('cat') + .setDescription('Get a random cat!'), + async execute(interaction, api) { + await api.get('cat')() + .then(async (res) => { + await interaction.reply(res); + }); + } +};