Discord漫游器:通过名称呼叫用户? [英] Discord bot: Call a user by name?

查看:43
本文介绍了Discord漫游器:通过名称呼叫用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小机器人,想用@和他的名字呼叫用户.因此,他在频道中获得了亮点.我写了

I have a little bot and want call a user with @ and his name. So he get a highlight in the channel. I wrote

bot.sendMessage({to: channelID, message: '@Nickname message text'});

但这仅将@Nickname写为文本,而不突出显示.有解决方案吗?

But this only write @Nickname as text, without highlighting. Is there a solution for this?

推荐答案

所提及的语法实际上是< @ USER_ID> .您可以使用 User :: mention() 生成该字符串:

The syntax for mentions is actually <@USER_ID>. You can use User::mention() to generate that string:

bot.sendMessage({to: channelID, message: `${user.mention()} message text`});

这篇关于Discord漫游器:通过名称呼叫用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆