feat(qzone): delete_qzone_msg — delete a 说说 by tid via web API
deleteQzoneMsg POSTs a form-urlencoded tid to taotao.qzone.qq.com's emotion_cgi_delete_v6 (proxied through h5.qzone), on the bot's own space. Success has no positive payload beyond code 0, so the contract is throw-on-non-zero-code (foreign/unknown tid or auth failure); the server only deletes feeds the hostUin owns. Rejects empty tid pre-flight. - core: QzoneApi.delete; onebot: delete_qzone_msg action; regen catalog. - tests: tid form-body/url/headers lock, empty-tid preflight, non-zero code throw, and bridge self-space threading.
This commit is contained in:
6 files changed
+159
-2
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
deleteQzoneMsg,
|
||||
getQzoneFeeds,
|
||||
getQzoneMsgList,
|
||||
publishQzoneMsg,
|
||||
@@ -41,4 +42,10 @@ export class QzoneApi {
|
||||
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
|
||||
return publishQzoneMsg(cookieObject, this.ctx.identity.uin, content);
|
||||
}
|
||||
|
||||
/** 删除机器人自己空间的一条说说(按 tid)。 */
|
||||
async delete(tid: string): Promise<void> {
|
||||
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
|
||||
await deleteQzoneMsg(cookieObject, this.ctx.identity.uin, tid);
|
||||
}
|
||||
}
|
||||
@@ -58,4 +58,13 @@ describe('apis/qzone', () => {
|
||||
expect(pubSpy).toHaveBeenCalledWith({ p_skey: 'PSK' }, '10001', 'hello');
|
||||
expect(out).toEqual({ tid: 'T', time: 1 });
|
||||
});
|
||||
|
||||
it('delete removes a feed by tid from the bot\'s own space', async () => {
|
||||
const getCookies = vi.fn(async () => ({ p_skey: 'PSK' }));
|
||||
const bridge = mockBridge({ apis: { ...mockApiHub(), web: { getCookies } } as never });
|
||||
const delSpy = vi.spyOn(qzoneWeb, 'deleteQzoneMsg').mockResolvedValue();
|
||||
await new QzoneApi(bridge as never).delete('TID9');
|
||||
expect(getCookies).toHaveBeenCalledWith('qzone.qq.com');
|
||||
expect(delSpy).toHaveBeenCalledWith({ p_skey: 'PSK' }, '10001', 'TID9');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user