This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
anitrox/commands/8ball.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

const { Constants } = require('discord.js');
module.exports = {
name: require('path').parse(__filename).name,
description: 'Ask Anitrox a question, any question! and they will answer it!',
options: [{
name: 'question',
description: 'The question to ask Anitrox',
required: true,
type: Constants.ApplicationCommandOptionTypes.STRING
}],
async execute (client, message, args, config) {
2022-03-29 11:06:04 -05:00
const index = Math.floor(Math.random() * config.answers.length);
const answer = config.answers[index];
const question = args.slice(0).join(' ');
const avatarURL = message.author.displayAvatarURL();
if (!question) {
await message.channel.send(client.generateErrorMessage('You need to ask a question!', avatarURL));
} else {
await message.channel.send({
embeds: [{
title: ':8ball: 8Ball',
description: `Your amazing question: **${question}**`,
color: 9442302,
footer: {
icon_url: avatarURL,
text: config.footerTxt
},
fields: [
{
name: 'Answer',
value: `${answer}`
}
]
}]
});
}
}
};