Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Simply fills text with entities markup

License

Notifications You must be signed in to change notification settings

deptyped/telegram-text-entities-filler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED: Bot API since version 5 has ability to specify message entities using MessageEntity

Introduction

Simple library that helps fills text with entities markup

Installation

$ npm install telegram-text-entities-filler

or using yarn:

$ yarn add telegram-text-entities-filler

Example

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();