mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Butt command, improve scrabble score
This commit is contained in:
@@ -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]}`);
|
||||
}
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user