admin管理员组文章数量:1355528
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...`}
)
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...`}
)
Share
Improve this question
asked Aug 9, 2020 at 13:49
pragmatrickpragmatrick
6452 gold badges11 silver badges25 bronze badges
1 Answer
Reset to default 2It'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
本文标签: javascriptMentioning peopleroles inside an embed (discordjs)Stack Overflow
版权声明:本文标题:javascript - Mentioning peopleroles inside an embed (discord.js) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743954228a2567843.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论