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