feat(onebot): add Qzone profile read and update actions (#586)
Add actions to read a space name and description and update the current account profile. Preserve omitted fields and support explicit empty values, with matching SDK types, MCP discovery, documentation, and tests.
This commit is contained in:
16 files changed
+862
-3
No files matched your search
@@ -56,6 +56,7 @@ export const actionParams = {
|
||||
get_qun_album_list: { group_id: '10001', attach_info: '' },
|
||||
get_qzone_feeds: { page_num: '1', count: '10', cursor: 'cursor-from-previous-response' },
|
||||
get_qzone_msg_list: { target_uin: '10002', pos: '0', num: '20' },
|
||||
get_qzone_profile: { target_uin: '10002' },
|
||||
get_rkey_server: {},
|
||||
get_share_link: fileset,
|
||||
like_qzone: qzoneLike,
|
||||
@@ -99,6 +100,7 @@ export const actionParams = {
|
||||
},
|
||||
set_qzone_ban: { user_id: '10002', enable: false },
|
||||
set_qzone_msg_right: { tid: 'post', ugc_right: '128', target_uins: ['10002'] },
|
||||
set_qzone_profile: { name: 'Space', description: '' },
|
||||
share_group_ex: { group_id: '10001' },
|
||||
share_peer: peer,
|
||||
test_download_stream: { error: false },
|
||||
@@ -155,6 +157,7 @@ export type CoveredAction =
|
||||
| 'get_qun_album_list'
|
||||
| 'get_qzone_feeds'
|
||||
| 'get_qzone_msg_list'
|
||||
| 'get_qzone_profile'
|
||||
| 'get_rkey_server'
|
||||
| 'get_share_link'
|
||||
| 'like_qzone'
|
||||
@@ -176,6 +179,7 @@ export type CoveredAction =
|
||||
| 'set_group_robot_add_option'
|
||||
| 'set_qzone_ban'
|
||||
| 'set_qzone_msg_right'
|
||||
| 'set_qzone_profile'
|
||||
| 'share_group_ex'
|
||||
| 'share_peer'
|
||||
| 'test_download_stream'
|
||||
@@ -364,6 +368,7 @@ export const actionResults = {
|
||||
},
|
||||
],
|
||||
},
|
||||
get_qzone_profile: { name: 'Space', description: 'Description' },
|
||||
get_rkey_server: { expired_time: 1, name: 'SnowLuma', private_rkey: 'fixture' },
|
||||
get_share_link: 'https://example.com/share',
|
||||
like_qzone: null,
|
||||
@@ -385,6 +390,7 @@ export const actionResults = {
|
||||
set_group_robot_add_option: null,
|
||||
set_qzone_ban: null,
|
||||
set_qzone_msg_right: { ugc_right: 128 },
|
||||
set_qzone_profile: null,
|
||||
share_group_ex: '{}',
|
||||
share_peer: { arkMsg: '{}' },
|
||||
test_download_stream: {
|
||||
|
||||
+22
@@ -74,9 +74,11 @@ export const feedContent: string | null | undefined = feeds.feeds[0].content;
|
||||
export const feedPhotos: string[] | null | undefined = feeds.feeds[0].images;
|
||||
export const feedLikeCount: number | null | undefined = feeds.feeds[0].like_count;
|
||||
export const feedCursor: string | null | undefined = feeds.next_cursor;
|
||||
|
||||
if (feedCursor) {
|
||||
await http.raw('get_qzone_feeds', { cursor: feedCursor, count: 10 });
|
||||
}
|
||||
|
||||
export const legacyFeedsResult: ActionResult<'get_qzone_feeds'> = {
|
||||
feeds: [{ uin: 10002, nickname: 'User', time: 1, appid: 311, key: 'post', html: '' }],
|
||||
has_more: false,
|
||||
@@ -93,6 +95,26 @@ export const legacyQzoneComment: ActionParams<'comment_qzone'> = {
|
||||
images: ['https://example.com/image.png'],
|
||||
};
|
||||
export const legacyQzoneResult: ActionResult<'comment_qzone'> = { comment_id: '' };
|
||||
const qzoneProfile = await http.raw('get_qzone_profile', actionParams.get_qzone_profile);
|
||||
export const qzoneName: string = qzoneProfile.name;
|
||||
export const qzoneDescription: string = qzoneProfile.description;
|
||||
export const ownQzoneProfile = http.raw('get_qzone_profile', {});
|
||||
export const qzoneProfileUpdate: Promise<null> = ws.raw('set_qzone_profile', {
|
||||
name: 'Space',
|
||||
description: '',
|
||||
});
|
||||
export const qzoneNameOnly: ActionParams<'set_qzone_profile'> = { name: 'Space' };
|
||||
export const qzoneDescriptionOnly: ActionParams<'set_qzone_profile'> = { description: '' };
|
||||
export const qzoneScalarFields: ActionParams<'set_qzone_profile'> = {
|
||||
name: 123,
|
||||
description: false,
|
||||
};
|
||||
// @ts-expect-error a space profile patch requires at least one field
|
||||
export const emptyQzoneProfilePatch: ActionParams<'set_qzone_profile'> = {};
|
||||
export const invalidQzoneProfilePatch: ActionParams<'set_qzone_profile'> = {
|
||||
// @ts-expect-error profile fields accept string, number or boolean primitives
|
||||
description: [],
|
||||
};
|
||||
const speech = await ws.raw('get_record_text', { message_id: -42 });
|
||||
const transcription: string = speech.text;
|
||||
const flash = await http.raw('get_fileset_info', { fileset_id: 'files' });
|
||||
|
||||
Reference in new issue
Block a user