mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Scrabble Score Command
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "84.4.2",
|
||||
"version": "84.5.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user