feat(qzone): like_qzone / unlike_qzone — like/unlike a 说说 via web API
setQzoneLike POSTs a form body to w.qzone.qq.com's internal_dolike_app (like) or internal_unlike_app (unlike), proxied through h5.qzone, keyed by the feed's mood unikey/curkey (http://user.qzone.qq.com/<uin>/mood/<tid>) and fid=tid, as the bot (opUin). target_uin selects whose 说说 (defaults to the bot's own); scope is 说说 (mood, appid 311). Throws on non-zero code/subcode. Rejects empty tid pre-flight. WRITE — rate-limit (风控). - core: QzoneApi.like(tid, targetUin?, like); onebot: like_qzone + unlike_qzone actions; regen catalog. - tests: dolike vs unlike CGI selection, unikey/curkey/fid/opuin form lock, empty-tid preflight, code+subcode throws, and bridge owner- defaulting (self vs friend) + like-flag threading.
This commit is contained in:
6 files changed
+287
-2
No files matched your search
@@ -3,6 +3,7 @@ import {
|
||||
getQzoneFeeds,
|
||||
getQzoneMsgList,
|
||||
publishQzoneMsg,
|
||||
setQzoneLike,
|
||||
type QzoneFeedsResult,
|
||||
type QzoneMsgListResult,
|
||||
type QzonePublishResult,
|
||||
@@ -48,4 +49,15 @@ export class QzoneApi {
|
||||
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
|
||||
await deleteQzoneMsg(cookieObject, this.ctx.identity.uin, tid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给一条说说点赞/取消赞。`targetUin` 省略时点赞机器人自己空间的说说;
|
||||
* 点赞好友说说时传好友 uin(tid 来自 get_qzone_feeds / get_qzone_msg_list)。
|
||||
*/
|
||||
async like(tid: string, targetUin: number | undefined, like: boolean): Promise<void> {
|
||||
const selfUin = this.ctx.identity.uin;
|
||||
const owner = targetUin && targetUin > 0 ? targetUin.toString() : selfUin;
|
||||
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
|
||||
await setQzoneLike(cookieObject, selfUin, owner, tid, like);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user