最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to ping a role in a discord.js embed - Stack Overflow

programmeradmin1浏览0评论

I want to ping a specific role in a discord embed. I tried <@652878254927249420> but it only work on a classic message. Is it possible to ping a role in an embed ? If yes how can I do it ?

I want to ping a specific role in a discord embed. I tried <@652878254927249420> but it only work on a classic message. Is it possible to ping a role in an embed ? If yes how can I do it ?

Share edited Mar 31, 2022 at 10:27 Zsolt Meszaros 23.2k19 gold badges58 silver badges69 bronze badges asked Apr 5, 2021 at 13:22 qasdf7qasdf7 631 gold badge1 silver badge8 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

To ping a role by its ID, you can use <@&652878254927249420>. There is an extra ampersand (&) after the at (@).

You can use it in embeds, but mentions won't work in the title, author, or footer, only inside setDescription and addField's value.

If you have a role object like this, you can simply mention it using template literals:

const role = message.guild.roles.cache.get('652878254927249420');

message.channel.send(`I'm mentioning ${role}, ehh`);

Simply use the Role#ToString method.

message.guild.roles.cache.get("652878254927249420").toString();
发布评论

评论列表(0)

  1. 暂无评论