Scrabble Score Command

This commit is contained in:
Daniel Odendahl Jr
2018-07-15 02:31:36 +00:00
parent 42b23aeafa
commit 3f89e01b32
4 changed files with 64 additions and 2 deletions
+2 -1
View File
@@ -15,7 +15,7 @@ You can invite the bot to your server using
Be sure to also join the [home server](https://discord.gg/sbMe32W) for
information and support.
## Commands (294)
## Commands (295)
### Utility:
* **prefix**: Shows or sets the command prefix.
@@ -160,6 +160,7 @@ information and support.
* **rule-of-the-internet**: Responds with a rule of the internet.
* **rule34**: Responds with an image from Rule34, with optional query.
* **safebooru**: Responds with an image from Safebooru, with optional query.
* **scrabble-score**: Responds with the scrabble score of a word.
* **stack-overflow**: Searches Stack Overflow for your query.
* **steam**: Searches Steam for your query.
* **stocks**: Responds with the current stocks for a specific symbol.
+29
View File
@@ -0,0 +1,29 @@
{
"a": 1,
"b": 3,
"c": 3,
"d": 2,
"e": 1,
"f": 4,
"g": 2,
"h": 4,
"i": 1,
"j": 8,
"k": 5,
"l": 1,
"m": 3,
"n": 1,
"o": 1,
"p": 3,
"q": 10,
"r": 1,
"s": 1,
"t": 1,
"u": 1,
"v": 4,
"w": 4,
"x": 8,
"y": 4,
"z": 10,
" ": 0
}
+32
View File
@@ -0,0 +1,32 @@
const Command = require('../../structures/Command');
const letters = require('../../assets/json/roman-numeral');
module.exports = class ScrabbleScoreCommand extends Command {
constructor(client) {
super(client, {
name: 'scrabble-score',
aliases: ['scrabble'],
group: 'number-edit',
memberName: 'scrabble-score',
description: 'Responds with the scrabble score of a word.',
args: [
{
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()
}
]
});
}
run(msg, { word }) {
let score = 0;
for (const letter of word.split('')) score += letters[letter];
return msg.reply(score);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "84.4.2",
"version": "84.5.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {