How to transform html/markdown input to text+entities for sending in telegram api with nodejs?

29 views Asked by At

https://core.telegram.org/api/entities

The are examples only on c++ and php How to transform

<b>bold</b> sample

to something likes this on nodejs? (I use https://gram.js.org)

const result = await client.invoke(
  new Api.messages.SendMessage({
    peer: '@username',
    message: 'bold sample',
    entities: [
      new Api.MessageEntityBold({
        offset: 0,
        length: 4,
      })],
  }),
);
1

There are 1 answers

0
Bohdlesk On

You can try this paraser https://www.npmjs.com/package/@tgsnake/parser. Helps for me