Node-telegram-bot-api: Text styling

Created on 23 Jan 2018  路  3Comments  路  Source: yagop/node-telegram-bot-api

Feature Request

I have:

  • searched for such a feature request (https://github.com/yagop/node-telegram-bot-api/labels/enhancement) and found none

Introduction

In Telegram you can style text like this **bold text** or __italic text__.
The node-telegram-bot-api seems not to support this.
On the other hand, Emojis are working.

Most helpful comment

As it mention in telegram documentation, you just need to add parse_mode to options. As in the example below:

bot.onText(/\/start/, function onStart(msg) {
  const opts = {
    reply_markup:{
      keyboard: [
        ['FAQ'],
        ['Buy']
      ]
    },
    parse_mode: 'Markdown'
  };
  bot.sendMessage(msg.from.id, "*You are welcome!*\nWe would like to introduce you our new [product](https://xxx.yyy/zzz)", opts);
});

All 3 comments

Use parse_mode: 'Markdown', 馃憤

As it mention in telegram documentation, you just need to add parse_mode to options. As in the example below:

bot.onText(/\/start/, function onStart(msg) {
  const opts = {
    reply_markup:{
      keyboard: [
        ['FAQ'],
        ['Buy']
      ]
    },
    parse_mode: 'Markdown'
  };
  bot.sendMessage(msg.from.id, "*You are welcome!*\nWe would like to introduce you our new [product](https://xxx.yyy/zzz)", opts);
});

Perfect! Will try this today. Thank you!

Was this page helpful?
0 / 5 - 0 ratings