Make age more accurate for future years

This commit is contained in:
Dragon Fire
2020-11-28 15:41:09 -05:00
parent 1fde7a8b11
commit f7882fe4a8
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -20,6 +20,8 @@ module.exports = class AgeCommand extends Command {
run(msg, { year }) {
const currentYear = new Date().getFullYear();
return msg.say(`Someone born in ${year} would be ${currentYear - year} years old.`);
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.`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "122.0.0",
"version": "122.0.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {