Telegram bot for building and sending Rich Messages using Bot API 10.1 (June 2026).
ربات تلگرام برای ساخت و ارسال پیامهای غنی (Rich Message) با دستورات ساده و گامبهگام.
- 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
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
| Variable |
Required |
Description |
TELEGRAM_BOT_TOKEN |
Yes |
Bot token from BotFather |
RUST_LOG |
No |
Log level (info, debug, …) |
| 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) |
| 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 |
| Command |
Description |
/table |
Table (step-by-step: header → rows → /done) |
/list |
Unordered list |
/olist |
Ordered list |
/quote |
Block quote |
/divider |
Horizontal divider |
| 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.
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 ارسال شد!
- User commands build a list of rich blocks stored in an in-memory session.
- On
/send, blocks are converted to HTML and sent via sendRichMessage.
- Telegram-uploaded photos are sent separately with
sendPhoto.
- Bot token is redacted from error logs.
.
├── src/main.rs # Bot logic, API calls, block builders
├── Cargo.toml
├── .env.example
└── LICENSE
- 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).
MIT — see LICENSE.