mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-08 16:47:47 +00:00
chore: migrate repository to standard knowledge base layout
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 🤖 telegram-dev
|
||||
|
||||
> Telegram Bot 开发实战经验
|
||||
|
||||
## 项目背景
|
||||
|
||||
Telegram Bot 开发中遇到的问题和解决方案,主要涉及消息格式、Markdown 渲染等。
|
||||
|
||||
## 文档列表
|
||||
|
||||
| 文件 | 说明 |
|
||||
|:---|:---|
|
||||
| [telegram Markdown 代码块格式修复记录 2025-12-15.md](telegram%20Markdown%20代码块格式修复记录%202025-12-15.md) | Telegram Markdown 代码块渲染问题修复 |
|
||||
|
||||
## 技术栈
|
||||
|
||||
- Python
|
||||
- python-telegram-bot
|
||||
- Telegram Bot API
|
||||
@@ -0,0 +1,41 @@
|
||||
# telegram Markdown 代码块格式修复记录 2025-12-15
|
||||
|
||||
## 问题
|
||||
|
||||
排盘完成后发送消息报错:
|
||||
```
|
||||
❌ 排盘失败: Can't parse entities: can't find end of the entity starting at byte offset 168
|
||||
```
|
||||
|
||||
## 原因
|
||||
|
||||
`bot.py` 中 `header` 消息的 Markdown 代码块格式错误。
|
||||
|
||||
原代码使用字符串拼接,在 ``` 后面加了 `\n`,导致 Telegram Markdown 解析器无法正确识别代码块边界:
|
||||
|
||||
```python
|
||||
# 错误写法
|
||||
header = (
|
||||
"```\n"
|
||||
f"{filename}\n"
|
||||
"```\n"
|
||||
)
|
||||
```
|
||||
|
||||
## 修复
|
||||
|
||||
改用三引号字符串,确保 ``` 单独成行:
|
||||
|
||||
```python
|
||||
# 正确写法
|
||||
header = f"""报告见附件
|
||||
```
|
||||
{filename}
|
||||
{ai_filename}
|
||||
```
|
||||
"""
|
||||
```
|
||||
|
||||
## 修改文件
|
||||
|
||||
- `services/telegram-service/src/bot.py` 第 293-308 行
|
||||
Reference in New Issue
Block a user