2024-05-23 09:22:31 +00:00
|
|
|
function returnDog() {
|
2024-05-23 14:59:07 +00:00
|
|
|
//https://random.dog/woof.json
|
|
|
|
//random 1 or 2
|
|
|
|
var random = Math.floor(Math.random() * 2) + 1;
|
|
|
|
if (random === 1) {
|
|
|
|
return fetch('https://random.dog/woof.json')
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => data.url);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-23 09:22:31 +00:00
|
|
|
return fetch('https://dog.ceo/api/breeds/image/random')
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => data.message);
|
2024-05-23 14:59:07 +00:00
|
|
|
}
|
2024-05-23 09:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'dog',
|
|
|
|
description: 'Get a random dog picture',
|
|
|
|
help: 'Get a random dog picture',
|
|
|
|
options: [],
|
|
|
|
slash: true,
|
|
|
|
text: true,
|
|
|
|
admin: false,
|
|
|
|
requireKick: false,
|
|
|
|
requireBan: false,
|
|
|
|
canBeUsedInDm: true,
|
|
|
|
premium: false,
|
|
|
|
contexts: ['GUILD_TEXT', 'GUILD_VOICE', 'DM'],
|
|
|
|
integration_types: [0,1],
|
|
|
|
execute: async (message, args) => {
|
|
|
|
const dog = await returnDog();
|
|
|
|
message.channel.send(dog);
|
|
|
|
},
|
|
|
|
executeSlash: async interaction => {
|
|
|
|
const dog = await returnDog();
|
|
|
|
interaction.reply(dog);
|
|
|
|
},
|
|
|
|
};
|