From 0983f202b5c9431ce66699350612e35d9f0ad6b4 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 20 Nov 2017 21:22:17 +0000 Subject: [PATCH] Beep --- commands/info/role.js | 6 +++--- commands/util/help.js | 11 ++++++----- package.json | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/commands/info/role.js b/commands/info/role.js index a9f22bd4..a164eff1 100644 --- a/commands/info/role.js +++ b/commands/info/role.js @@ -1,6 +1,6 @@ const { Command } = require('discord.js-commando'); const { MessageEmbed } = require('discord.js'); -const { util } = require('discord.js-commando'); +const { util: { permissions } } = require('discord.js-commando'); module.exports = class RoleInfoCommand extends Command { constructor(client) { @@ -24,7 +24,7 @@ module.exports = class RoleInfoCommand extends Command { run(msg, { role }) { const serialized = role.permissions.serialize(); - const perms = Object.keys(util.permissions).filter(perm => serialized[perm]); + const perms = Object.keys(permissions).filter(perm => serialized[perm]); const embed = new MessageEmbed() .setColor(role.hexColor) .addField('❯ Name', @@ -40,7 +40,7 @@ module.exports = class RoleInfoCommand extends Command { .addField('❯ Mentionable', role.mentionable ? 'Yes' : 'No', true) .addField('❯ Permissions', - perms.map(perm => util.permissions[perm]).join(', ') || 'None'); + perms.map(perm => permissions[perm]).join(', ') || 'None'); return msg.embed(embed); } }; diff --git a/commands/util/help.js b/commands/util/help.js index b53c57df..6abb215f 100644 --- a/commands/util/help.js +++ b/commands/util/help.js @@ -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.'); } diff --git a/package.json b/package.json index bc9917de..6be5f722 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "55.1.1", + "version": "55.1.2", "description": "Your personal server companion.", "main": "XiaoBot.js", "scripts": {