Files
xiao/commands/guild-info/role-info.js
T
Daniel Odendahl Jr 1c9ac56831 Change arg assignment
2017-09-16 01:44:44 +00:00

46 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const { util } = require('discord.js-commando');
module.exports = class RoleInfoCommand extends Command {
constructor(client) {
super(client, {
name: 'role-info',
aliases: ['role'],
group: 'guild-info',
memberName: 'role-info',
description: 'Responds with detailed information on a role.',
guildOnly: true,
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'role',
prompt: 'Which role would you like to get information on?',
type: 'role'
}
]
});
}
run(msg, { role }) {
const perms = Object.keys(util.permissions).filter(perm => role.serialize()[perm]);
const embed = new MessageEmbed()
.setColor(role.hexColor)
.addField(' Name',
role.name, true)
.addField(' ID',
role.id, true)
.addField(' Color',
role.hexColor.toUpperCase(), true)
.addField(' Creation Date',
role.createdAt.toDateString(), true)
.addField(' Hoisted',
role.hoist ? 'Yes' : 'No', true)
.addField(' Mentionable',
role.mentionable ? 'Yes' : 'No', true)
.addField(' Permissions',
perms.map(perm => util.permissions[perm]).join(', ') || 'None');
return msg.embed(embed);
}
};