Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Beautifier Bot

Telegram bot for building and sending Rich Messages using Bot API 10.1 (June 2026).

ربات تلگرام برای ساخت و ارسال پیام‌های غنی (Rich Message) با دستورات ساده و گام‌به‌گام.

Features

  • Compose rich messages from blocks: headings, paragraphs, tables, lists, quotes, dividers
  • Inline formatting: bold, italic, code, spoiler
  • Embed images via public URL (/image) or send Telegram photos separately
  • RTL support (is_rtl: true) for Persian content
  • Lightweight stack: Rust + reqwest, no Telegram SDK dependency
  • Per-user in-memory sessions

Prerequisites

Quick start

git clone git@github.com:Aalamifar/Text-Beautifier-bot-telegram.git
cd Text-Beautifier-bot-telegram

cp .env.example .env
# Edit .env and set TELEGRAM_BOT_TOKEN

RUST_LOG=info cargo run --release

Environment variables

Variable Required Description
TELEGRAM_BOT_TOKEN Yes Bot token from BotFather
RUST_LOG No Log level (info, debug, …)

Commands

Session management

Command Description
/start Welcome message
/new Start a new message
/send Send the composed rich message
/status Show added blocks
/cancel Cancel and clear session
/help Full command reference
/done Finish multi-step blocks (table, list)

Text blocks

Command Description
/text [text] Plain paragraph
/bold [text] Bold text
/italic [text] Italic text
/code [text] Inline code
/spoiler [text] Spoiler text
/heading [1-6] [text] Section heading

Structure blocks

Command Description
/table Table (step-by-step: header → rows → /done)
/list Unordered list
/olist Ordered list
/quote Block quote
/divider Horizontal divider

Images

Method Description
/image [URL] [caption] Embed image from a public http(s) URL inside the rich message
Send a photo in chat Added as a block; sent separately via sendPhoto on /send

Telegram file photos cannot be embedded inline in rich HTML yet. Use /image with a public URL for inline images.

Example workflow

User: /new
Bot:  ✅ پیام جدید شروع شد!

User: /heading 1 گزارش فروش ماهانه
Bot:  ✅ بلاک «RichBlockSectionHeading» اضافه شد (مجموع: 1).

User: /text در این ماه فروش ما به رکورد جدیدی رسید.
Bot:  ✅ بلاک «RichBlockParagraph» اضافه شد (مجموع: 2).

User: /table
Bot:  هدر ستون‌ها رو بفرست...

User: محصول	فروش	درآمد
User: لپ‌تاپ	150	450,000,000
User: /done
Bot:  ✅ بلاک کامل شد!

User: /send
Bot:  ✅ پیام Rich Message ارسال شد!

How it works

  1. User commands build a list of rich blocks stored in an in-memory session.
  2. On /send, blocks are converted to HTML and sent via sendRichMessage.
  3. Telegram-uploaded photos are sent separately with sendPhoto.
  4. Bot token is redacted from error logs.

Project structure

.
├── src/main.rs      # Bot logic, API calls, block builders
├── Cargo.toml
├── .env.example
└── LICENSE

Production notes

  • Sessions live in RAM and are lost on restart. Use Redis or a database for persistence.
  • Run with --release for better performance.
  • Keep .env out of version control (already in .gitignore).

License

MIT — see LICENSE.

About

This bot allows you to beautify text in Telegram

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages