1.1.1 • Published 2 years ago

telegram-escape v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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

Kind: global function

md`template_${string}`String

Kind: global function

mdv1`template_${string}`String

Kind: global function

escapeHTML(text) ⇒ String

Kind: global function

ParamType
textString

escapeMarkdown(text) ⇒ String

Kind: global function

ParamType
textString

escapeMarkdownV1(text) ⇒ String

Kind: global function

ParamType
textString
1.1.1

2 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago