feat: Discord 原生转发合并消息(issue #28) - #111
Merged
This-is-XiaoDeng merged 1 commit intoAug 13, 2026
Merged
Conversation
… node2image 潜伏 bug - 新增 utils/native_forward.py:合并转发整体判定(要么全部原生 forward、要么整体回退图片) - cached_messages 快查 → 本地 DB 解析频道,配合 REST 只读预检,突破缓存时间范围限制 - 配置项 use_native_forward(默认 True)与 native_forward_max_nodes(默认无限制) - 批量发送遵守 Discord 频道限流(5 条 / 5 秒) - send_group_forward_msg 接入原生转发,失败自动回退 node2image 图片方案 - send_private_forward_msg 保持图片方案(转发到 DM 尚未实测) - 修复 utils/discord_api.py:httpx 0.28 的 proxies→proxy、data→json(否则 delete/edit/forward 全部发错格式) - 修复 utils/node2image.py:v11 parser 无 parse_string,改用 parse_string_to_array - 版本号升至 1.0.2;新增 test_native_forward.py 13 例判定单元测试
This-is-XiaoDeng
merged commit Aug 13, 2026
61dd0a5
into
ITCraftDevelopmentTeam:master
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
实现 issue #28:合并转发不再完全依赖
cached_messages,改用 Discord 原生 forward(message_referencetype=1,快照由服务端生成),可转发更久之前、未被缓存的消息。整体判定原则:要么全部节点原生转发,要么整体回退 node2image 图片方案。变更
utils/native_forward.py:can_native_forward():逐节点无损判定(引用型 node、channel 经 cached_messages→本地 DB 解析、REST 只读预检存在性/可读性/类型/同服务器、节点数阈值),任一不满足返回Nonesend_native_forward():批量POST /channels/{target}/messages,遵守频道限流节奏(5 条/5 秒)system.use_native_forward(默认True)、system.native_forward_max_nodes(默认无限制)send_group_forward_msg:先试原生转发,失败/降级自动回退图片send_private_forward_msg:保持图片方案(转发到 DM 尚未实测,注释说明)顺带修复(测试中发现的历史 bug)
utils/discord_api.py:httpx 0.28 已将proxies改名为proxy,且data=会发表单格式而非 JSON —— 修复前edit_message/delete_message/本功能全部会失败utils/node2image.py:v11 parser 无parse_string,图片回退渲染 message_id 节点必崩,改用parse_string_to_array测试
test_native_forward.py13 例全部通过(内联/不可转发类型/转发套转发/超阈值/跨服务器/DB+预检/混合等)message_reference.type=1+message_snapshots由服务端生成 ✅