mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
28 lines
713 B
JavaScript
28 lines
713 B
JavaScript
const Command = require('../../structures/Command');
|
|
|
|
module.exports = class AgeCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'age',
|
|
group: 'analyze',
|
|
memberName: 'age',
|
|
description: 'Responds with how old someone born in a certain year is.',
|
|
args: [
|
|
{
|
|
key: 'year',
|
|
prompt: 'What year would you like to get the age for?',
|
|
type: 'integer',
|
|
min: 1
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
run(msg, { year }) {
|
|
const currentYear = new Date().getFullYear();
|
|
const age = currentYear - year;
|
|
if (age < 0) return msg.say(`Someone born in ${year} will be born in ${Math.abs(age)} years.`);
|
|
return msg.say(`Someone born in ${year} would be ${age} years old.`);
|
|
}
|
|
};
|