简体   繁体   English

"Java Discord 机器人,@提及用户?"

[英]Java Discord bot, @mention a user?

There doesn't seem to be much about this on google aside from advising to use their userID (a string of numbers) instead of their name.除了建议使用他们的用户 ID(一串数字)而不是他们的名字之外,谷歌上似乎没有太多关于此的内容。

I enabled dev mode to grab their ID and tried the below however it just comes out as a plain text message with no @mention.我启用了开发模式来获取他们的 ID 并尝试了以下操作,但它只是作为没有@提及的纯文本消息出现。

chan.sendMessage("Hey @299059199160352768 are you there?").queue();

Any ideas?有任何想法吗?

Just add an opening and closing angle bracket.只需添加一个开始和结束尖括号。 <@id> . <@id> So your string would look like所以你的字符串看起来像

chan.sendMessage("Hey <@299059199160352768> are you there?").queue();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM