This commit is contained in:
Daniel Odendahl Jr
2017-11-20 21:22:17 +00:00
parent 843f2925a8
commit 0983f202b5
3 changed files with 10 additions and 9 deletions
+6 -5
View File
@@ -1,6 +1,7 @@
const { Command } = require('discord.js-commando');
const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
const { util: { disambiguation } } = require('discord.js-commando');
module.exports = class HelpCommand extends Command {
constructor(client) {
@@ -34,11 +35,9 @@ module.exports = class HelpCommand extends Command {
**Format**: ${msg.anyUsage(`${data.name} ${data.format || ''}`)}
**Aliases**: ${data.aliases.join(', ') || 'None'}
**Group**: ${data.group.name} (\`${data.groupID}:${data.memberName}\`)
**Examples**:
${data.examples ? data.examples.join('\n') : 'None'}
`);
} else if (commands.length > 1) {
return msg.say(`Multiple commands found: ${commands.map(cmd => cmd.name).join(', ')}`);
return msg.say(disambiguation(commands, 'commands'));
}
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands.`);
} else {
@@ -50,8 +49,10 @@ module.exports = class HelpCommand extends Command {
embed.addField(` ${group.name}`, group.commands.map(cmd => cmd.name).join(', ') || 'None');
}
try {
await msg.direct({ embed });
return msg.say('📬 Sent you a DM with information.');
const msgs = [];
msgs.push(await msg.direct({ embed }));
if (msg.channel.type !== 'dm') msgs.push(await msg.say('📬 Sent you a DM with information.'));
return msgs;
} catch (err) {
return msg.reply('Failed to send DM. You probably have DMs disabled.');
}