feat: delay long-running task notices

This commit is contained in:
zenord
2026-08-17 15:35:18 +08:00
parent 2795567f8c
commit 680a449cd8
6 changed files with 589 additions and 164 deletions
+5 -5
View File
@@ -8,7 +8,7 @@ const config: QqConfig = {
botNames: ["Bot"], intents: 33_554_432, shard: [0, 1]
};
test("normalizes GROUP and C2C author openid while ACK remains immediate", async () => {
test("normalizes GROUP and C2C author openid while webhook ACK remains immediate", async () => {
const received: any[] = [];
const gateway = { receive: async (message: unknown) => { received.push(message); throw new Error("ACP failed"); } };
const adapter = new QqAdapter(config, gateway as never);
@@ -31,12 +31,12 @@ test("sendMessage uses C2C endpoint and forwards reply sequences as msg_seq", as
try {
const adapter = new QqAdapter(config, { receive: async () => ({ ok: true }) } as never);
const target = { platform: "qq", chatId: "user:u2", raw: { author: { user_openid: "u2" } } };
await adapter.sendMessage({ target, text: "ack", replyTo: "m2", replySequence: 1 });
await adapter.sendMessage({ target, text: "reply", replyTo: "m2", replySequence: 2 });
await adapter.sendMessage({ target, text: "first", replyTo: "m2", replySequence: 1 });
await adapter.sendMessage({ target, text: "later", replyTo: "m2", replySequence: 7 });
assert.ok(urls.some((url) => url.endsWith("/v2/users/u2/messages")));
assert.deepEqual(bodies, [
{ content: "ack", msg_id: "m2", msg_seq: 1 },
{ content: "reply", msg_id: "m2", msg_seq: 2 }
{ content: "first", msg_id: "m2", msg_seq: 1 },
{ content: "later", msg_id: "m2", msg_seq: 7 }
]);
} finally { globalThis.fetch = original; }
});