Used RichEmbed class

merge-requests/3/head
DedShot™#9195 2020-04-15 20:14:20 -04:00
parent 4141482c21
commit 8678b0878b
1 changed files with 17 additions and 49 deletions

View File

@ -1,11 +1,12 @@
import { Message } from 'eris';
import { Client, Command } from '../class';
import { Client, Command, RichEmbed } from '../class';
export default class Roleinfo extends Command {
constructor(client: Client) {
super(client);
this.name = 'roleinfo';
this.description = 'Get information about a role.';
this.usage = "roleinfo [role ID or role name]"
this.permissions = 0;
this.guildOnly = true;
this.enabled = true;
@ -48,56 +49,23 @@ export default class Roleinfo extends Command {
hasPerms = true;
}
const embed = { embed: {
description: `<@&${role.id}> ID: \`${role.id}\``,
author: {
name: `${message.author.username}#${message.author.discriminator}`,
icon_url: message.author.avatarURL,
},
color: role.color,
fields: [
{
name: 'Name',
value: role.name,
inline: true,
},
{
name: 'Color',
value: `#${role.color.toString(16)}`,
inline: true,
},
{
name: 'Hoisted',
value: role.hoist,
inline: true,
},
{
name: 'Position',
value: role.position,
inline: true,
},
{
name: 'Creation Date',
value: `${date} ${time}`,
inline: true,
},
{
name: 'Mentionable',
value: role.mentionable,
inline: true,
},
],
footer: {
text: `${this.client.user.username}`,
icon_url: this.client.user.avatarURL,
},
timestamp: new Date(),
} };
let embed = new RichEmbed()
embed.setDescription(`<@&${role.id}> ID: \`${role.id}\``)
embed.setAuthor(`${message.author.username}#${message.author.discriminator}`, message.author.avatarURL)
embed.setColor(role.color)
embed.addField("Name", role.name, true)
embed.addField("Color", `#${role.color.toString(16)}`, true)
embed.addField("Hoisted", role.hoist.toString(), true)
embed.addField("Position", role.position.toString(), true)
embed.addField("Creation Date", `${date} ${time}`, true)
embed.addField("Mentionnable", role.mentionable.toString(), true)
embed.setFooter(this.client.user.username, this.client.user.avatarURL)
embed.setTimestamp()
if (hasPerms) {
embed.embed.fields.push({ name: 'Permissions', value: permsArray, inline: false });
embed.fields.push({ name: 'Permissions', value: permsArray, inline: false });
}
message.channel.createMessage(embed);
message.channel.createMessage({embed: embed});
} catch (err) {
this.client.createMessage(message.channel.id, `${this.client.util.emojis.ERROR} An unexpected error has occured.`);
}