2023-05-23 01:14:17 -04:00
|
|
|
import Discord from 'discord.js';
|
2023-04-14 06:47:58 -04:00
|
|
|
import TClient from '../client.js';
|
2023-12-24 10:21:40 -05:00
|
|
|
export default class RoleInfo {
|
|
|
|
static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
2023-03-05 05:04:10 -05:00
|
|
|
const role = interaction.options.getRole('role') as Discord.Role;
|
|
|
|
const permissions = role.permissions.toArray();
|
|
|
|
interaction.reply({embeds: [new client.embed().setColor(role.color || '#fefefe').setThumbnail(role?.iconURL()).setTitle(`Role Info: ${role.name}`).addFields(
|
|
|
|
{name: '🔹 ID', value: `\`${role.id}\``, inline: true},
|
|
|
|
{name: '🔹 Color', value: `\`${role.hexColor}\``, inline: true},
|
|
|
|
{name: '🔹 Creation Date', value: `<t:${Math.round(role.createdTimestamp/1000)}>\n<t:${Math.round(role.createdTimestamp/1000)}:R>`, inline: true},
|
2023-07-07 09:49:24 -04:00
|
|
|
{name: '🔹 Misc', value: `Hoist: \`${role.hoist}\`\nMentionable: \`${role.mentionable}\`\nPosition: \`${role.position}\` from bottom\nMembers: \`${role.members.size}\`\n${role.members.size < 21 ? role.members.map((e:Discord.GuildMember)=>`**${e.user.username}**`).join('\n') || '' : ''}`, inline: true},
|
|
|
|
{name: '🔹 Permissions', value: `${permissions.includes('Administrator') ? ['Administrator'] : permissions.join(', ').replace(/([a-z])([A-Z])/g, '$1 $2') || 'No permissions'}`, inline: true}
|
2023-12-24 10:21:40 -05:00
|
|
|
)]})
|
|
|
|
}
|
|
|
|
static data = new Discord.SlashCommandBuilder()
|
2023-03-05 05:04:10 -05:00
|
|
|
.setName('roleinfo')
|
|
|
|
.setDescription('View information about the selected role')
|
2023-05-23 01:14:17 -04:00
|
|
|
.addRoleOption(x=>x
|
2023-03-05 05:04:10 -05:00
|
|
|
.setName('role')
|
|
|
|
.setDescription('Role name to view information')
|
|
|
|
.setRequired(true))
|
2023-12-24 10:21:40 -05:00
|
|
|
}
|