Butt command, improve scrabble score

This commit is contained in:
Daniel Odendahl Jr
2018-09-05 15:04:56 +00:00
parent 1ee36ef8eb
commit 3d76d81e48
6 changed files with 64 additions and 9 deletions
+29
View File
@@ -0,0 +1,29 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const texts = require('../../assets/json/butt');
module.exports = class ButtCommand extends Command {
constructor(client) {
super(client, {
name: 'butt',
aliases: ['butts', 'ass', 'booty'],
group: 'analyze',
memberName: 'butt',
description: 'Determines a user\'s butt quality.',
args: [
{
key: 'user',
prompt: 'Which user do you want to determine the butt quality of?',
type: 'user',
default: msg => msg.author
}
]
});
}
run(msg, { user }) {
const random = new Random(Random.engines.mt19937().seed(user.id));
const quality = random.integer(0, texts.length - 1);
return msg.reply(`${user.id === msg.author.id ? 'ur' : `${user.username}'s`} butt is ${texts[quality]}`);
}
};
+4 -5
View File
@@ -14,10 +14,6 @@ module.exports = class ScrabbleScoreCommand extends Command {
key: 'word',
prompt: 'What word would you like to get the scrabble score of?',
type: 'string',
validate: word => {
if (/^[A-Za-z ]+$/i.test(word.toLowerCase())) return true;
return 'Invalid word, please only use A-Z and space.';
},
parse: word => word.toLowerCase()
}
]
@@ -26,7 +22,10 @@ module.exports = class ScrabbleScoreCommand extends Command {
run(msg, { word }) {
let score = 0;
for (const letter of word.split('')) score += letters[letter];
for (const letter of word.split('')) {
if (!letters[letter]) continue;
score += letters[letter];
}
return msg.reply(score);
}
};