diff --git a/assets/json/generation.json b/assets/json/generation.json new file mode 100644 index 00000000..b644762d --- /dev/null +++ b/assets/json/generation.json @@ -0,0 +1,27 @@ +[ + { + "name": "Gen Z", + "start": 1996, + "end": null + }, + { + "name": "Millennials", + "start": 1977, + "end": 1995 + }, + { + "name": "Generation X", + "start": 1965, + "end": 1976 + }, + { + "name": "Baby Boomers", + "start": 1946, + "end": 1964 + }, + { + "name": "Silent Generation", + "start": 1, + "end": 1945 + } +] diff --git a/commands/analyze/generation.js b/commands/analyze/generation.js new file mode 100644 index 00000000..75593252 --- /dev/null +++ b/commands/analyze/generation.js @@ -0,0 +1,28 @@ +const Command = require('../../structures/Command'); +const generations = require('../../assets/json/generation'); + +module.exports = class GenerationCommand extends Command { + constructor(client) { + super(client, { + name: 'generation', + aliases: ['gen'], + group: 'analyze', + memberName: 'generation', + description: 'Responds with the Generation for the given year.', + args: [ + { + key: 'year', + prompt: 'What year would you like to get the Generation for?', + type: 'integer', + min: 1, + max: new Date().getFullYear() + } + ] + }); + } + + run(msg, { year }) { + const generation = generations.find(gen => gen.start <= year && (gen.end ? gen.end >= year : true)); + return msg.say(`Someone born in ${year} is part of: **${generation.name}**`); + } +}; diff --git a/package.json b/package.json index 3405bf6b..2b225a52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "134.13.0", + "version": "134.14.0", "description": "Your personal server companion.", "main": "Xiao.js", "private": true,