From e174e9a4644091dcc2458e45e550d22fe12da970 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 22 May 2021 11:35:26 -0400 Subject: [PATCH] Is Leap Year Command --- commands/events/is-leap.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 commands/events/is-leap.js diff --git a/commands/events/is-leap.js b/commands/events/is-leap.js new file mode 100644 index 00000000..0e22fc85 --- /dev/null +++ b/commands/events/is-leap.js @@ -0,0 +1,27 @@ +const Command = require('../../structures/Command'); +const { isLeap } = require('../../util/Util'); + +module.exports = class IsLeapCommand extends Command { + constructor(client) { + super(client, { + name: 'is-leap', + aliases: ['is-leap-year', 'leap-year', 'leap'], + group: 'events', + memberName: 'is-leap', + description: 'Responds with if a year is a leap year.', + args: [ + { + key: 'year', + prompt: 'What year would you like to get data for?', + type: 'integer', + default: () => new Date().getFullYear(), + min: 1 + } + ] + }); + } + + run(msg, { year }) { + return msg.say(`${year} **${isLeap(year) ? 'is' : 'is not'}** a leap year.`); + } +};