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/choose.js

24 lines
843 B
JavaScript

module.exports = {
name: 'choose',
description: "Give some lines of input, and get one back at random",
async execute(client, message, _, config) {
var strarr = message.content.split(/\s*\n\s*/);
strarr[0] = strarr[0].slice(this.name.length + config.prefix.length);
console.log(strarr);
const answer = strarr[Math.floor(Math.random() * strarr.length)];
if (answer === "") {
await message.channel.send(client.generateErrorMessage("You need to provide some input!", message.author.displayAvatarURL()));
} else {
await message.channel.send({embed: {
"title": "I have made my decision:",
"description": answer,
"color": 8311585,
"footer": {
"icon_url": message.author.displayAvatarURL(),
"text": config.footerTxt
},
}});
}
}
}