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.`); + } +};