从我的自定义 Discord 机器人中 Ping 自动消息中的角色
我面临着关于我的Discord机器人的问题。 我做出了一个自动答案,可以在用户扮演角色时抚摸他。 一切正常,用户会被刺穿,并且嵌入按计划显示。
我想在此消息中添加角色ping。以下代码的问题在于,角色不会被刺穿(只是角色,用户名和嵌入式工作)。它只是显示了代码中的角色的ID。
有人可以告诉我,这行是否有错误:
channel.send({content :`**${oldMember.user} something is written here** <@&11111111111111>, something is written here too`, embeds :\[embed\]});
(1111111111 = rome ID)
我希望每次发送此消息时我的bot ping the wore。 我也尝试了提到的代码行,但这显示了“@dreated-lole”:
channel.send({content :`**${oldMember.user} something is written here** <@&${1111111111111}, something is written here too`, embeds :\[embed\]});
I'm facing an issue concerning my Discord bot.
I made an automatic answer that pings the user when he gets a role.
Everything works fine, the user gets pinged and the embed appears as planed.
I would like to add a role ping to this message. The problem with the following code is that the role won't get pinged (just the role, the username and the embed work perfectly). It just shows the ID of the role exactly like in the code.
Could someone tell me if there's an error in this line:
channel.send({content :`**${oldMember.user} something is written here** <@&11111111111111>, something is written here too`, embeds :\[embed\]});
(11111111111 = role ID)
I expect my bot to ping the role every time this message is sent.
I tried the mentioned code line and this one as well, but this shows "@deleted-role":
channel.send({content :`**${oldMember.user} something is written here** <@&${1111111111111}, something is written here too`, embeds :\[embed\]});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一番研究,我找到了一个可行的代码:
https:// Discord.js.org/#/docs/discord.js/stable/class/RoleManager Discord.js 文档作为资源非常有用。
After some researching, I found a workable code:
https://discord.js.org/#/docs/discord.js/stable/class/RoleManager the Discord.js documentations are really helpful as a resource.