feat(qzone): comment_qzone — comment on a 说说 via web API
commentQzoneMsg POSTs a form body to taotao.qzone.qq.com's emotion_cgi_re_feeds (proxied through h5.qzone), keyed by topicId <hostUin>_<tid>__1, as the bot (uin=self) on target_uin's feed (defaults to the bot's own space). Returns the new comment id best-effort — the response field name varies (commentid/commentId) so a missing id with code 0 is still success. Throws on non-zero code/subcode; rejects empty tid/content pre-flight. WRITE — rate-limit (风控). topicId shape + comment-id field are extrapolated from community impls, pending a live capture (labeled in the helper comment). - core: QzoneApi.comment; onebot: comment_qzone action; regen catalog. - tests: re_feeds form lock (topicId/uin/hostUin/content/format=fs), commentid + camelCase commentId fallback + missing-id success, empty tid/content preflight, non-zero code throw, bridge owner-defaulting.
This commit is contained in:
6 files changed
+253
-2
No files matched your search
@@ -128,6 +128,27 @@ export const actions = [
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
// comment_qzone — 评论一条说说。target_uin=说说所属 QQ 号(省略=机器人自己空间)。
|
||||
// 写操作;高频评论会被 Qzone 风控,调用方需限流。
|
||||
defineAction({
|
||||
name: 'comment_qzone',
|
||||
summary: '评论一条说说(QQ 空间)',
|
||||
params: {
|
||||
tid: f.string({ allowEmpty: false }).describe('说说 tid'),
|
||||
content: f.string({ allowEmpty: false }).describe('评论内容'),
|
||||
target_uin: f.uint().describe('说说所属 QQ 号,省略则为机器人自己').optional(),
|
||||
},
|
||||
run: async (p, ctx) => {
|
||||
try {
|
||||
const res = await ctx.bridge.apis.qzone.comment(p.tid, p.content, p.target_uin);
|
||||
return okResponse(res as unknown as JsonValue);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'failed to comment qzone msg';
|
||||
return failedResponse(RETCODE.INTERNAL_ERROR, message);
|
||||
}
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export function register(h: ApiHandler, ctx: ApiActionContext): void {
|
||||
|
||||
Reference in new issue
Block a user