Compare commits
No commits in common. "6e4c4452e715c36b93f5fe7d986a575f531d8eb0" and "20ebc7ee9031fa4bba76d6d21d45ecee4fc43294" have entirely different histories.
6e4c4452e7
...
20ebc7ee90
3 changed files with 2 additions and 54 deletions
|
@ -1,52 +0,0 @@
|
|||
const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('roleinfo')
|
||||
.setDescription('Provides information about the targetted role.')
|
||||
.addRoleOption(option =>
|
||||
option
|
||||
.setName('role')
|
||||
.setDescription('Which role are you checking?')
|
||||
.setRequired(true))
|
||||
.setDMPermission(false),
|
||||
async execute(interaction) {
|
||||
const role = interaction.options.getRole('role');
|
||||
const role_color = role.hexColor !== '#000000' ? role.hexColor : '#99aab5';
|
||||
const role_color_url_safe = role_color.toString().replace('#', '');
|
||||
const formattedCreationDate = `<t:${Math.floor(role.createdTimestamp / 1000)}>`;
|
||||
let managed = role.managed ? 'True' : 'False';
|
||||
let managed_description = '';
|
||||
if (managed == 'True') {
|
||||
if (role.tags.botId) {
|
||||
managed_description += `\n**Management Type:** Managed Bot Role\n**Managed By:** <@${String(role.tags.botId)}>`;
|
||||
} else if (role.tags.premiumSubscriberRole) {
|
||||
managed_description += '\n**Management Type:** Nitro Booster Role';
|
||||
} else if (role.tags.guildConnections) {
|
||||
managed_description += '\n**Management Type:** Guild Connections Role';
|
||||
} else if (role.tags.availableForPurchase) {
|
||||
managed_description += '\n**Management Type:** Subscription Role';
|
||||
}
|
||||
}
|
||||
managed += managed_description;
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(role_color)
|
||||
.setTitle(role.name)
|
||||
.setDescription(`**ID:** ${role.id}\n**Mention:** ${role}\n**Creation Date:** ${formattedCreationDate}\n**Color:** [${role_color}](https://www.color-hex.com/color/${role_color_url_safe})\n**Hoisted:** ${role.hoist ? 'True' : 'False'}\n**Position:** ${role.position}\n **Managed:** ${managed}\n**Mentionable:** ${role.mentionable ? 'True' : 'False'}\n**Administrator:** ${role.permissions.has([PermissionsBitField.Flags.Administrator]) ? 'True' : 'False'}`);
|
||||
if (role.icon) {
|
||||
embed.setThumbnail(role.iconURL());
|
||||
} else if (role.unicodeEmoji) {
|
||||
embed.setThumbnail(await fetchTwemoji(role.unicodeEmoji));
|
||||
}
|
||||
await interaction.reply({ embeds: [embed], ephemeral: true });
|
||||
},
|
||||
};
|
||||
|
||||
async function fetchTwemoji(unicodeEmoji) {
|
||||
const base_url = 'https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/72x72/';
|
||||
const emojiCodepoint = unicodeEmoji.split('').map(char => char.charCodeAt(0).toString(16)).join('-');
|
||||
const segments = emojiCodepoint.split('-');
|
||||
const validSegments = segments.filter(seg => seg.length >= 4);
|
||||
const emojiUrl = `${base_url}${validSegments[0]}.png`;
|
||||
return emojiUrl;
|
||||
}
|
|
@ -2,7 +2,7 @@ const { SlashCommandBuilder } = require('discord.js');
|
|||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('serverinfo')
|
||||
.setName('server')
|
||||
.setDescription('Provides information about the server.'),
|
||||
async execute(interaction) {
|
||||
await interaction.reply(`This server is ${interaction.guild.name} and has ${interaction.guild.memberCount} members.`);
|
|
@ -2,7 +2,7 @@ const { SlashCommandBuilder } = require('discord.js');
|
|||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('userinfo')
|
||||
.setName('user')
|
||||
.setDescription('Provides information about the user.'),
|
||||
async execute(interaction) {
|
||||
// interaction.user is the object representing the User who ran the command
|
Loading…
Reference in a new issue