Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

javascript - Use bold tag to send my message from node server

I want to use Bold tag example: <b>Hiii</b> to send my messages to user on running of node server.

I am using : npm Tgfancy

Node

const chatId = '-xxxxxx';

const token = '566470572:ffffff';

const bot = new Tgfancy(token, {
    // all options to 'tgfancy' MUST be placed under the
    // 'tgfancy' key, as shown below
    tgfancy: {
        option: "value",
    },
});

bot.sendMessage(parse_mode='HTML', chatId, replyText);

How can I parse HTML with that?

I have my content but its not tagging with bold or any other HTML tags.

My code

var replyText = " Signal #"+coinName+ " has reached 1st target! " +profit+ "% profit 
Current Price:" +liveCoinPrice+ "
Duration: " +difference + "
Note: Message from live coin high node server";

Here, I want to bold coinName, profit, etc.

Output

enter image description here

Any help would be thankful.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This worked for parse_mode = "HTML".

https://github.com/yagop/node-telegram-bot-api/issues/108

var replyText = "Signal #" + coinName.bold() + " has reached 2nd target! " + profit.bold() + "% profit 
Current Price: " + liveCoinPrice.bold() + "
Duration: " + difference.bold();

var option = {
  "parse_mode": "HTML",
};

bot.sendMessage(msg.chat.id, replyText, option);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...