Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram 发送内容比较多的 Markdown 消息报错:Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 4030 #88

Closed
ilay1678 opened this issue May 16, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@ilay1678
Copy link

Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 4030

内容少的就能发送成功

@songquanpeng
Copy link
Owner

这个问题出在 Telegram 对 Markdown 的解析。如果内容比较多,Message Pusher 会对其进行拆分。对于 Markdown 内容,拆分点如果不合适的话会导致报错。

这个问题并不好解决,Message Pusher 必须要能解析 Markdown 文本并在最大消息长度前找到合适的拆分点才能避免该问题。

@songquanpeng songquanpeng changed the title telegram发送内容比较多的markdown报错 Telegram 发送内容比较多的 Markdown 消息报错:Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 4030 May 16, 2023
@songquanpeng songquanpeng added the bug Something isn't working label May 16, 2023
@songquanpeng
Copy link
Owner

songquanpeng commented May 16, 2023

可以参考 #79#73

@songquanpeng
Copy link
Owner

我想到一种比较简单的解决方法,即通过句号分隔消息,然后进行拼接,同时保证长度不超标,应该足以应付大多数场景了。

@ilay1678
Copy link
Author

或许可以试试将内容存储到telegra.ph telegram好像完美支持这个网站的即时预览

@songquanpeng
Copy link
Owner

songquanpeng commented May 19, 2023 via email

@ilay1678
Copy link
Author

ilay1678 commented May 19, 2023 via email

@songquanpeng
Copy link
Owner

songquanpeng commented May 19, 2023 via email

@songquanpeng
Copy link
Owner

这个平台的 content 格式不好适配,我目前还是打算采用之前的方法进行分隔。

@songquanpeng
Copy link
Owner

已修复,目前的解决方案是在最大消息长度的索引前面找一个最近的 \n 进行消息的划分。

已推送版本 v0.4.10-alpha,期待反馈~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants