added cat command & api

This commit is contained in:
Mestima 2023-03-28 23:51:54 +03:00
parent d829bcd891
commit 9f65304389
2 changed files with 26 additions and 0 deletions

13
src/api/cat/index.js Normal file
View File

@ -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 };

13
src/commands/cat/index.js Normal file
View File

@ -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);
});
}
};