Shasha/cmds/owner/groups.js
2021-06-28 18:12:39 +09:00

30 lines
866 B
JavaScript

const { stripIndents } = require('common-tags');
const Command = require('../../node_modules/@iceprod/discord.js-commando/src/commands/base');
module.exports = class ListGroupsCommand extends Command {
constructor(client) {
super(client, {
name: 'groups',
aliases: ['list-groups', 'show-groups'],
group: 'owner',
memberName: 'groups',
description: 'Lists all command groups.',
details: 'Only administrators may use this command.',
guarded: true
});
}
hasPermission(msg) {
if(!msg.guild) return this.client.isOwner(msg.author);
return msg.member.permissions.has('ADMINISTRATOR') || this.client.isOwner(msg.author);
}
run(msg) {
return msg.reply(stripIndents`
__**Groups**__
${this.client.registry.groups.map(grp =>
`**${grp.name}:** ${grp.isEnabledIn(msg.guild) ? 'Enabled' : 'Disabled'}`
).join('\n')}
`);
}
};