From f6668f3482996de46e1d9eb57439ea4e74f66310 Mon Sep 17 00:00:00 2001 From: Rogee Date: Sun, 20 Sep 2026 16:12:32 +0800 Subject: [PATCH] Fix false DM build failure --- ...6-09-20-16-11-remote-dm-wrapper-failure.md | 27 +++++++++++++++++++ src/douyin_im.py | 2 +- src/test_douyin_im.py | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 docs/2026-09-20-16-11-remote-dm-wrapper-failure.md diff --git a/docs/2026-09-20-16-11-remote-dm-wrapper-failure.md b/docs/2026-09-20-16-11-remote-dm-wrapper-failure.md new file mode 100644 index 0000000..a3c8d22 --- /dev/null +++ b/docs/2026-09-20-16-11-remote-dm-wrapper-failure.md @@ -0,0 +1,27 @@ +# 远程最近一次私信失败复核 + +- 时间:2026-09-20 16:11 +- 主机:`10.1.1.101` + +## 结果 + +远程最新 replay 任务不是抖音 SDK 的发送拒绝,而是本地包装代码记录的: + +- 任务状态:`failed` +- 结果:`MESSAGE_BUILD_FAILED` +- 发送参数已使用当前规则,UID 冷却为 60 秒。 + +## 根因 + +上一版已切换到站内 `sendMessageManager.sendMessage(builder)`,但发送完成后仍额外检查 `builder.getMessage().sendFunc`。当前抖音 builder 构造出的消息对象不保证暴露 `sendFunc`;站内 manager 自己可以正常使用该消息完成发送,因此这个检查会把发送后的结果错误标成失败。 + +由于旧代码没有持久化 manager 返回值,不能从任务账本证明这一次远端消息是否已经实际送达;不能直接重试,避免重复私信。 + +## 修复与部署 + +- 仅保留 `builder.getMessage()` 是否存在的构造检查,移除错误的 `sendFunc` 检查。 +- 离线 IM 测试改为覆盖没有 `sendFunc` 的真实 builder 形态。 +- 测试:IM 2、账号 47、计划 7,通知/activity、编译、diff、LSP 均通过。 +- Windows 原生重新构建并安装成功,安装/构建 `DouyinAccounts.exe` SHA-256: + `7309A2C1688EDD4CA01581D9D348DC610827EAAF234027CE07E98AE193E4A1D4` +- 未对该任务自动补发;需用户确认消息是否实际到达后,再决定是否手动重下发。 diff --git a/src/douyin_im.py b/src/douyin_im.py index 620a608..49c7c9a 100644 --- a/src/douyin_im.py +++ b/src/douyin_im.py @@ -84,7 +84,7 @@ EXPRESSION = r""" aweType: 700, type: 0, richTextInfos: [], text: p.text})); const result = await sendManager.sendMessage(builder); const message = builder.getMessage(); - if (!message || typeof message.sendFunc !== 'function') fail('MESSAGE_BUILD_FAILED'); + if (!message) fail('MESSAGE_BUILD_FAILED'); let checkInfo = {}; if (typeof result?.checkMsg === 'string' && result.checkMsg) { try { checkInfo = JSON.parse(result.checkMsg); } catch (_) { /* fixed fields below */ } diff --git a/src/test_douyin_im.py b/src/test_douyin_im.py index c0a22c4..31f25c5 100644 --- a/src/test_douyin_im.py +++ b/src/test_douyin_im.py @@ -25,7 +25,7 @@ const sdk = { assert.equal(p.conversation, conversation); assert.equal(p.type, 7); assert.deepEqual(JSON.parse(p.content), {aweType:700,type:0,richTextInfos:[],text:TEXT}); - return {sendFunc:()=>{}, sender:'54321', content:p.content, type:7}; + return {sender:'54321', content:p.content, type:7}; }, sendMessage: async ({message}) => { sent++; message.serverId='42'; return {success:true,statusCode:0,checkCode:0};