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

26 lines
855 B
JavaScript
Raw Normal View History

2022-04-18 11:06:53 -05:00
module.exports = {
name: require('path').parse(__filename).name,
2022-04-18 11:06:53 -05:00
description: "Give some lines of input, and get one back at random",
2022-04-18 11:06:53 -05:00
async execute(client, message, _, config) {
var strarr = message.content.split(/\s*\n\s*/);
strarr[0] = strarr[0].slice(this.name.length + config.prefix.length);
const answer = strarr[Math.floor(Math.random() * strarr.length)];
2022-04-18 11:06:53 -05:00
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
},
}});
}
}
}