mirror of
https://github.com/Mestima/luna.git
synced 2025-05-05 21:50:15 +00:00
added fox command & api
This commit is contained in:
parent
9ac7b12701
commit
d829bcd891
13
src/api/fox/index.js
Normal file
13
src/api/fox/index.js
Normal 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
13
src/commands/fox/index.js
Normal 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);
|
||||
});
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user