pragmatrick
pragmatrick

Reputation: 635

Mentioning people/roles inside an embed (discord.js)

I am trying to create for my discord server a set-roles channel, where every role is explained. I want my bot to say everything inside an embed, so noone would be tagged if their role is mentioned there. Unfortuanlty I really can't find a way to mention any role or any user in a simple way, without to getting the roles id and fetching the role. I have a lot of roles on my server and I just want a simple way of writing it, lets say I have a role "Verified", this is how I tried to code the embed:

.addFields(
{name: "All roles", value: `@Verified means you have accepted the rules\n @Moderator means...`}
)

Upvotes: 0

Views: 38733

Answers (1)

Jakye
Jakye

Reputation: 6625

It's enough to put the User object / GuildMember object and/or the Role object inside the embed and it will get mentioned.


const Moderator = message.guild.roles.cache.find(role => role.name == "Moderator");
Embed.addField("All Roles", `This is the ${Moderator ? `${Moderator}` : "role not found"} role.`);

Note: The following properties of RichEmbed (Discord JS v11) and MessageEmbed (Discord JS v12) do not support mentions:

  • Author
  • Title
  • Field Name
  • Footer

Upvotes: 2

Related Questions