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