added fox command & api

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

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

@ -0,0 +1,13 @@
import axios from 'axios';
const fox = async () => {
return await axios.get('https://randomfox.ca/floof/')
.then((res) => {
return res.data.image;
})
.catch((err) => {
console.log(err);
});
};
export default { name: 'fox', execute: fox };

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

@ -0,0 +1,13 @@
import { SlashCommandBuilder } from 'discord.js';
export default {
data: new SlashCommandBuilder()
.setName('fox')
.setDescription('Get a random fox!'),
async execute(interaction, api) {
await api.get('fox')()
.then(async (res) => {
await interaction.reply(res);
});
}
};