mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Generation Command
This commit is contained in:
@@ -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}**`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user