作为用户,您可以使用在不和谐中发送超链接消息
[Text](http://example.com)
它将像这样嵌入:
.
但是,如果我使用机器人通过discord.js 来完成此操作,则使用以下代码:
await source.channel.send("[text](http://example.com)")
它不会嵌入:
是否可以像用户一样做到这一点,或者机器人根本不可能做到这一点?
最佳答案
您需要将该消息格式化为超链接。
const msg = Formatters.hyperlink("", "http://example.com", text);
await source.channel.send(msg);
https://discord.js.org/#/docs/main/stable/class/Formatters?scrollTo=s-hyperlink
关于javascript - Discord.js 在普通消息上发送超链接,就像在用户消息中一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70471767/