feat(qzone): send_qzone_msg — publish a text 说说 via web API

First Qzone WRITE path. publishQzoneMsg POSTs a form-urlencoded body to
taotao.qzone.qq.com's emotion_cgi_publish_v6 (proxied through h5.qzone),
g_tk in the query, on the bot's own space. Returns the server-assigned
tid (the handle for later delete/comment/like) + post time.

- Throws on transport failure, non-zero Qzone code (content rejected /
  rate-limited), or a success body with no tid — never reports a publish
  as succeeded without the feed id. Rejects empty content pre-flight.
- 带图 (image) publishing is a later slice (needs the upload CGI first).
- Action carries a风控/限流 caveat: publishing is an active action and
  high frequency is rate-limited by Qzone, same as sending messages.

- core: QzoneApi.publish; onebot: send_qzone_msg action; regen catalog.
- tests: form-body/url/headers lock, empty-content preflight, non-zero
  code throw, missing-tid throw, and bridge self-space threading.
This commit is contained in:
DrSmoothl committed 2026-06-20 01:40:06 +08:00
1 parent b00f5ab759
commit 9f2eb37232
6 files changed
+204 -2

No files matched your search

+20
View File
@@ -47,6 +47,26 @@ export const actions = [
}
},
}),
// send_qzone_msg — 发表一条纯文字说说。写操作,发到机器人自己的空间。
// 返回新说说的 tid(供后续 delete/comment/like 使用)。
// 注意:发说说为主动行为,高频会被 Qzone 风控,调用方需自行限流。
defineAction({
name: 'send_qzone_msg',
summary: '发表一条纯文字说说(QQ 空间)',
params: {
content: f.string({ allowEmpty: false }).describe('说说正文'),
},
run: async (p, ctx) => {
try {
const res = await ctx.bridge.apis.qzone.publish(p.content);
return okResponse(res as unknown as JsonValue);
} catch (error) {
const message = error instanceof Error ? error.message : 'failed to publish qzone msg';
return failedResponse(RETCODE.INTERNAL_ERROR, message);
}
},
}),
];
export function register(h: ApiHandler, ctx: ApiActionContext): void {