node.jsapidiscord.jstext-formattingbold

discord.js sending the api response as a bold text


How to parse api response into bold text message to the discord channel?

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

This code will return message Price is: <b>1.33</b> and won't parse the text into bold.


Solution

  • You can send it just like in a normal Discord message with the two *. So it will look like

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