mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
31 lines
932 B
JavaScript
31 lines
932 B
JavaScript
const Command = require('../../framework/Command');
|
|
const moment = require('moment');
|
|
|
|
module.exports = class LastRunCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'last-run',
|
|
aliases: ['command-last-run', 'cmd-last-run', 'cmd-run', 'command-run'],
|
|
group: 'util-public',
|
|
memberName: 'last-run',
|
|
description: 'Responds with a command\'s most recent run date.',
|
|
guarded: true,
|
|
args: [
|
|
{
|
|
key: 'command',
|
|
type: 'command'
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
run(msg, { command }) {
|
|
if (command.unknown || command.lastRun === undefined) {
|
|
return msg.reply('That command\'s usage stats aren\'t being tracked.');
|
|
}
|
|
if (!command.lastRun) return msg.reply(`The \`${command.name}\` command has never been run.`);
|
|
const displayTime = moment.utc(command.lastRun).format('MM/DD/YYYY h:mm A');
|
|
return msg.say(`The \`${command.name}\` command was last run on **${displayTime}**.`);
|
|
}
|
|
};
|