Telegram Abstract Syntax Tree for Telegram message entities.
tgast provides a way to represent Telegram message entities as a structured format called an Abstract Syntax Tree (AST). It's built using the unist specification, making it easy to work with and extend.
For released versions, see releases.
tgast is a specification for representing Telegram message entities as an Abstract Syntax Tree (AST). It was initially created for the regram project.
tgast leverages the unist format for syntax trees, allowing you to benefit from its extensive ecosystem of utilities.
tgast is used within the regram and unified projects for processing Telegram message content.
You can use tgast by installing it from npm:
# deno
deno add -D npm:tgast
# bun
bun add -D tgast
# pnpm
pnpm add -D tgast
# yarn
yarn add -D tgast
# npm
npm install -D tgast
- Blockquote: Telegram block quotation. Represents
blockquote
entities in Telegram messages. - Bold: Telegram bold text. Represents
bold
entities in Telegram messages. - BotCommand: Telegram bot command. Represents
bot_command
entities in Telegram messages. - Cashtag: Telegram cashtag. Represents
cashtag
entities in Telegram messages. - Code: Telegram monowidth string. Represents
code
entities in Telegram messages. - CustomEmoji: Telegram custom emoji. Represents
custom_emoji
entities in Telegram messages. - Email: Telegram email address. Represents
email
entities in Telegram messages. - ExpandableBlockquote: Telegram expandable
blockquote. Represents
expandable_blockquote
entities in Telegram messages. - Hashtag: Telegram hashtag. Represents
hashtag
entities in Telegram messages. - Italic: Telegram italic text. Represents
italic
entities in Telegram messages. - Mention: Telegram mention. Represents
mention
entities in Telegram messages. - PhoneNumber: Telegram phone number. Represents
phone_number
entities in Telegram messages. - Pre: Telegram monowidth block. Represents
pre
entities in Telegram messages. - Spoiler: Telegram spoiler message. Represents
spoiler
entities in Telegram messages. - Strikethrough: Telegram strikethrough text. Represents
strikethrough
entities in Telegram messages. - Text: Telegram plain text. Represents plain text content in Telegram messages.
- TextLink: Telegram clickable text URL. Represents
text_link
entities in Telegram messages. - TextMention: Telegram mentions for users without
usernames. Represents
text_mention
entities in Telegram messages. - Underline: Telegram underline text. Represents
underline
entities in Telegram messages. - Url: Telegram URL. Represents
url
entities in Telegram messages.
See § Glossary in syntax-tree/unist
.
- regram: regram. Quadratz.
- unist: Universal Syntax Tree. T. Wormer; et al.
- Telegram Bot API: Telegram Message Entity. Telegram.