telegram-escape
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i telegram-escape

      Weekly Downloads

      14

      Version

      1.1.1

      License

      ISC

      Unpacked Size

      5.74 kB

      Total Files

      5

      Last publish

      Collaborators

      • masterarthur