【问题标题】:discord.js sending the api response as a bold textdiscord.js 以粗体文本发送 api 响应
【发布时间】:2021-09-12 15:56:32
【问题描述】:

如何将 api 响应解析为粗体文本消息发送到不和谐频道?

let channel = guild.channels.cache.get('ChannelID')
channel.send('Price is: ' + price.toFixed(2).bold(), { "parse_mode": "HTML" });

此代码将返回消息 Price is: <b>1.33</b> 并且不会将文本解析为粗体。

【问题讨论】:

    标签: node.js api discord.js text-formatting bold


    【解决方案1】:

    您可以像在普通的 Discord 消息中一样使用两个 *.所以它看起来像

    let channel = guild.channels.cache.get(`ChannelID`);
    channel.send(`Price is **${price.toFixed(2)}**`);
    

    【讨论】:

    • 谢谢!那行得通,但我从来没有像那样在消息中使用占位符。
    猜你喜欢
    • 2018-08-25
    • 2013-02-10
    • 2021-04-04
    • 2014-09-04
    • 1970-01-01
    • 2014-09-25
    • 2020-10-15
    • 1970-01-01
    • 2018-07-31
    相关资源
    最近更新 更多