Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async execute(client, kayn, REGIONS, config, message, args, con, guilds) {
if (this.playing.has(message.channel.id)) return message.reply('Only one game may be occurring per channel.');
this.playing.add(message.channel.id);
try {
urban.random().first(async json => {
const word = json.word.toLowerCase().replace(/ /g, '-');
let points = 0;
let displayText = null;
let guessed = false;
const confirmation = [];
const incorrect = [];
const display = new Array(word.length).fill('_');
while (word.length !== confirmation.length && points < 6) {
await message.channel.send(stripIndents`
${displayText === null ? 'Here we go!' : displayText ? 'Good job!' : 'Nope!'}
\`${display.join(' ')}\`. Which letter do you choose?
Incorrect Tries: ${incorrect.join(', ') || 'None'}
\`\`\`
___________
| |
| ${points > 0 ? 'O' : ''}
execute(client, kayn, REGIONS, config, message, args, con, guilds) {
urban.random().first(json => {
const def = new Discord.RichEmbed()
.setTitle(json.word)
.setDescription(json.definition)
.addField('Upvotes', json.thumbs_up, true)
.addField('Downvotes', json.thumbs_down, true)
.setTimestamp(new Date())
.setFooter(`Written by ${json.author}`);
message.channel.send(def);
});
},
};
module.exports.run = async (bot, message, args) => {
urban.random().first(json => {
let uEmbed = new Discord.RichEmbed()
.setTitle(json.word)
.setDescription(json.definition || "None")
.addField("Upvotes :arrow_up_small: ", json.thumbs_up, true)
.addField("Downvotes :arrow_down_small: ", json.thumbs_down, true)
.setAuthor(`Author: ${json.author}`);
message.channel.send(uEmbed);
});
}