Skip to content

mainarthur/telegram-escape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-escape

Codacy Badge

Lightweight Javascript utility zero-dependecy library for Telegram Bots developers for escaping user input with formatting options

Installation

npm i telegram-escape

Usage examples

const { HTML } = require("telegram-escape");

const firstName = "<My Cool Name>";

await bot.sendMessage(chatId, HTML`<b>${firstName}</b>`, {
  parse_mode: "HTML",
}); // bold "<My Cool Name>"

await bot.sendMessage(chatId, HTML`<b>${"2 < 3"}</b>`, {
  parse_mode: "HTML",
}); // bold "2 < 3"
const { md } = require("telegram-escape");

const firstName = "*My Cool Name*";

await bot.sendMessage(chatId, md`_${firstName}_`, {
  parse_mode: "MarkdownV2",
}); // italic "*My Cool Name*"

Functions

HTML`template_${string}`String
md`template_${string}`String
mdv1`template_${string}`String
escapeHTML(text)String
escapeMarkdown(text)String
escapeMarkdownV1(text)String

HTML`template_${string}`⇒ String

Kind: global function

md`template_${string}`⇒ String

Kind: global function

mdv1`template_${string}`⇒ String

Kind: global function

escapeHTML(text) ⇒ String

Kind: global function

Param Type
text String

escapeMarkdown(text) ⇒ String

Kind: global function

Param Type
text String

escapeMarkdownV1(text) ⇒ String

Kind: global function

Param Type
text String

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published