cmd.role.info

Retrieves detailed information about a role in the guild.

JavaScript
const { cmd } = require("syntx.js");

await cmd.role.info(role, message);

Parameters

ParameterTypeRequiredDescription
rolestringYesThe role ID to look up.
messagediscord.js MessageYesA guild message or interaction, used to access the guild.

Returns

An object with the following fields:

FieldTypeDescription
idstringThe role's ID.
namestringThe role's name.
colorstringThe role's primary color as a hex string (e.g. "#ff5733").
colorStylestringThe color style: "solid", "gradient", or "holographic".
colorsobjectThe full color set: { primary, secondary, tertiary }. Non-set values are null.
iconstring | nullURL of the role icon at 512px, or null if no icon is set.
unicodeEmojistring | nullThe role's unicode emoji, if set.
positionnumberThe role's position in the hierarchy.
permissionsstring[]Array of permission flag strings granted by the role.
hoistbooleanWhether members with this role are shown separately in the member list.
mentionablebooleanWhether the role can be mentioned by anyone.
managedbooleanWhether the role is managed by an integration (e.g. a bot role).
editablebooleanWhether the bot can edit this role.
flagsstring[]Array of role flag strings.
tagsobject | nullRole tags, if any. See tags below.
assignedMembersnumberNumber of cached members currently assigned this role.
createdAtDateWhen the role was created.

Tags

The tags field is null for regular roles. For special roles it contains:

FieldTypeDescription
botIdstring | nullID of the bot this role is linked to, if it is a bot role.
integrationIdstring | nullID of the integration that manages this role, if any.
premiumSubscriberRolebooleanWhether this is the server's Nitro booster role.
subscriptionListingIdstring | nullID of the subscription listing, if applicable.
availableForPurchasebooleanWhether the role is available for purchase.
guildConnectionsbooleanWhether the role is linked via guild connections.

Example

JavaScript
client.command({
  name: "roleinfo",
  content: async (message) => {
    const id = cmd.message.argument(1, message);
    if (!id) return message.reply("Please provide a role ID.");

    const info = await cmd.role.info(id, message);

    message.reply([
      `**Name:** ${info.name}`,
      `**Color:** ${info.color} (${info.colorStyle})`,
      `**Position:** ${info.position}`,
      `**Hoisted:** ${info.hoist}`,
      `**Mentionable:** ${info.mentionable}`,
      `**Members:** ${info.assignedMembers}`,
    ].join("\n"));
  },
});

Note

assignedMembers reflects only the members currently in the guild cache. In large servers without the GuildMembers intent, this count may be lower than the actual number of members with the role.