Birthstone Command

This commit is contained in:
Dragon Fire
2020-04-12 09:26:00 -04:00
parent 356aeb71bb
commit ca65c960da
5 changed files with 77 additions and 2 deletions
+2 -1
View File
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 384
Total: 385
### Utility:
@@ -349,6 +349,7 @@ Total: 384
### Analyzers:
* **age:** Responds with how old someone born in a certain year is.
* **birthstone:** Responds with the Birthstone for a month.
* **character-count:** Responds with the character count of text.
* **chinese-zodiac:** Responds with the Chinese Zodiac Sign for the given year.
* **face:** Determines the race, gender, and age of a face.
+44
View File
@@ -0,0 +1,44 @@
[
{
"primary": "Garnet"
},
{
"primary": "Amethyst"
},
{
"primary": "Aquamarine",
"alternative": ["Bloodstone"]
},
{
"primary": "Diamond"
},
{
"primary": "Emerald"
},
{
"primary": "Pearl",
"alternative": ["Moonstone", "Alexandrite"]
},
{
"primary": "Ruby"
},
{
"primary": "Peridot",
"alternative": ["Spinel"]
},
{
"primary": "Sapphire"
},
{
"primary": "Opal",
"alternative": ["Tourmaline"]
},
{
"primary": "Topaz",
"alternative": ["Citrine"]
},
{
"primary": "Turquoise",
"alternative": ["Zircon", "Tanzanite"]
}
]
+28
View File
@@ -0,0 +1,28 @@
const Command = require('../../structures/Command');
const { list } = require('../../util/Util');
const months = require('../../assets/json/month');
const stones = require('../../assets/json/birthstone');
module.exports = class BirthstoneCommand extends Command {
constructor(client) {
super(client, {
name: 'birthstone',
group: 'analyze',
memberName: 'birthstone',
description: 'Responds with the Birthstone for a month.',
args: [
{
key: 'month',
prompt: 'What month would you like to get the Zodiac Sign for?',
type: 'month'
}
]
});
}
run(msg, { month }) {
const stone = stones[month - 1];
const alternate = stone.alternate ? ` Alternatively, you can also use ${list(stone.alternate, 'or')}.` : '';
return msg.say(`The Birthstone for ${months[month - 1]} is ${stone.primary}.${alternate}`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "112.21.0",
"version": "112.22.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+2
View File
@@ -20,6 +20,8 @@ module.exports = class Util {
static list(arr, conj = 'and') {
const len = arr.length;
if (len === 0) return '';
if (len === 1) return arr[0];
return `${arr.slice(0, -1).join(', ')}${len > 1 ? `${len > 2 ? ',' : ''} ${conj} ` : ''}${arr.slice(-1)}`;
}