mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-17 21:08:05 +00:00
docs: 更新文档和技能
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 🤖 telegram-dev
|
||||
|
||||
> Telegram Bot Development Practical Experience
|
||||
|
||||
## Project Background
|
||||
|
||||
Problems and solutions encountered in Telegram Bot development, mainly involving message formatting, Markdown rendering, etc.
|
||||
|
||||
## Document List
|
||||
|
||||
| File | Description |
|
||||
|:---|:---|
|
||||
| [Telegram Markdown Code Block Format Fix Log 2025-12-15.md](./Telegram%20Markdown%20Code%20Block%20Format%20Fix%20Log%202025-12-15.md) | Telegram Markdown code block rendering issue fix |
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- Python
|
||||
- python-telegram-bot
|
||||
- Telegram Bot API
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
# telegram Markdown Code Block Format Fix Log 2025-12-15
|
||||
|
||||
## Problem
|
||||
|
||||
Error when sending message after chart generation:
|
||||
```
|
||||
❌ Chart generation failed: Can't parse entities: can't find end of the entity starting at byte offset 168
|
||||
```
|
||||
|
||||
## Cause
|
||||
|
||||
The Markdown code block format in the `header` message in `bot.py` is incorrect.
|
||||
|
||||
The original code used string concatenation, adding `\n` after ```, which prevented the Telegram Markdown parser from correctly recognizing the code block boundary:
|
||||
|
||||
```python
|
||||
# Incorrect usage
|
||||
header = (
|
||||
"```\n"
|
||||
f"{filename}\n"
|
||||
"```\n"
|
||||
)
|
||||
```
|
||||
|
||||
## Fix
|
||||
|
||||
Changed to use triple-quoted strings, ensuring ``` is on its own line:
|
||||
|
||||
```python
|
||||
# Correct usage
|
||||
header = f"""Report in attachment
|
||||
```
|
||||
{filename}
|
||||
{ai_filename}
|
||||
```
|
||||
"""
|
||||
```
|
||||
|
||||
## Modified File
|
||||
|
||||
- `services/telegram-service/src/bot.py` lines 293-308
|
||||
|
||||
Reference in New Issue
Block a user