Or do that

This commit is contained in:
Daniel Odendahl Jr
2017-05-02 22:58:41 +00:00
parent aed4e4906f
commit b18241f7bc
+4 -3
View File
@@ -27,7 +27,8 @@ module.exports = class HelpCommand extends Command {
async run(msg, args) { async run(msg, args) {
const { command } = args; const { command } = args;
const commands = this.client.registry.findCommands(command, false, msg); const commands = this.client.registry.findCommands(command, false, msg);
if (command && command !== 'all') { const showAll = command && command.toLowerCase() === 'all';
if (command && !showAll) {
if (commands.length === 1) { if (commands.length === 1) {
msg.say(stripIndents` msg.say(stripIndents`
__Command **${commands[0].name}**:__ *${commands[0].description}* __Command **${commands[0].name}**:__ *${commands[0].description}*
@@ -48,12 +49,12 @@ module.exports = class HelpCommand extends Command {
} }
} else { } else {
const embed = new RichEmbed() const embed = new RichEmbed()
.setTitle(command !== 'all' ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands') .setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
.setDescription(`Use ${this.usage('<command>', null, null)} to view detailed information about a specific command.`) .setDescription(`Use ${this.usage('<command>', null, null)} to view detailed information about a specific command.`)
.setColor(0x00AE86); .setColor(0x00AE86);
for (const group of this.client.registry.groups.array()) { for (const group of this.client.registry.groups.array()) {
embed.addField(group.name, embed.addField(group.name,
command !== 'all' ? group.commands.filter(c => c.isUsable(msg)).map(c => `\`${c.name}\``).join(', ') || 'None Available' : group.commands.map(c => `\`${c.name}\``).join(', ')); !showAll ? group.commands.filter(c => c.isUsable(msg)).map(c => `\`${c.name}\``).join(', ') || 'None Available' : group.commands.map(c => `\`${c.name}\``).join(', '));
} }
try { try {
await msg.author.send({embed}); await msg.author.send({embed});