Skip to content

fix: 被回复消息已删除时忽略回复并继续转发 - #92

Merged
pplulee merged 1 commit into
mainfrom
cursor/reply-missing-forward-d37a
Nov 23, 2026
Merged

pplulee merged 1 commit into
mainfrom
cursor/reply-missing-forward-d37a

Conversation

@pplulee

@pplulee pplulee commented Nov 21, 2026

Copy link
Copy Markdown
Member

用户私聊回复较早的消息时,如果管理群话题里对应的映射消息已被删除,Telegram 会返回 400: message to be replied not found,整条转发失败。

本次改动:

  • 所有映射回复发送都带上 allow_sending_without_reply=True(reply_to_message_id 或 ReplyParameters)
  • 跨聊天 / 论坛话题下该标志会被 Telegram 忽略,因此捕获 message to be replied not found / replied message not found 后去掉 reply kwargs 再发一次
  • 覆盖用户→群、管理员→用户的文本、媒体、贴纸等现有发送路径
  • 原有 quote 失败后嵌入 <blockquote> 的回退仍然有效;quote 回退后再遇到目标消息不存在时,也会去掉回复继续发送

测试:python -m pytest 已通过。

Open in Web Open in Cursor 

当映射的 reply 目标在 Telegram 侧不存在时,不再让整条转发失败,
而是去掉回复后正常发送。映射回复发送同时带上 allow_sending_without_reply。

Co-authored-by: pplulee <hi@pplulee.me>
@pplulee
pplulee merged commit ab7cd07 into main Nov 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants