DEPRECATED: Bot API since version 5 has ability to specify message entities using MessageEntity
Simple library that helps fills text with entities markup
$ npm install telegram-text-entities-filler
or using yarn
:
$ yarn add telegram-text-entities-filler
This bot will respond with the same message, keeping the text markup
const Telegraf = require('telegraf');
const { fillMarkdownEntitiesMarkup } = require('telegram-text-entities-filler');
const bot = new Telegraf(process.env.BOT_TOKEN);
bot.on('text', (ctx) =>
ctx.reply(
fillMarkdownEntitiesMarkup(ctx.message.text, ctx.message.entities),
{ parse_mode: "MarkdownV2" }
)
);
bot.launch();