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
+3 -3
View File
@@ -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);
}
};
+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.');
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "55.1.1",
"version": "55.1.2",
"description": "Your personal server companion.",
"main": "XiaoBot.js",
"scripts": {