mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
Make age more accurate for future years
This commit is contained in:
@@ -20,6 +20,8 @@ module.exports = class AgeCommand extends Command {
|
|||||||
|
|
||||||
run(msg, { year }) {
|
run(msg, { year }) {
|
||||||
const currentYear = new Date().getFullYear();
|
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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "122.0.0",
|
"version": "122.0.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user