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

+8
View File
@@ -1,8 +1,10 @@
import {
getQzoneFeeds,
getQzoneMsgList,
publishQzoneMsg,
type QzoneFeedsResult,
type QzoneMsgListResult,
type QzonePublishResult,
} from '@snowluma/protocol/web/qzone';
import type { BridgeContext } from '../bridge-context';
@@ -33,4 +35,10 @@ export class QzoneApi {
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
return getQzoneFeeds(cookieObject, this.ctx.identity.uin, pageNum, count);
}
/** 发表一条纯文字说说,返回新说说的 tid。始终发到机器人自己的空间。 */
async publish(content: string): Promise<QzonePublishResult> {
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
return publishQzoneMsg(cookieObject, this.ctx.identity.uin, content);
}
}