feat(onebot): support moving friends between categories

Add the set_friends_category action with either an existing category ID or an exact unique category name.

Validate the current friend and category roster before applying a change, reject missing or ambiguous targets, and surface failed updates instead of reporting false success. Expose the action through the SDK types and cover validation, successful updates, repeat requests, service rejection, and registry completeness.

Closes #297
This commit is contained in:
DrSmoothl committed 2026-07-30 10:37:16 +08:00
1 parent a3b790d472
commit f0ff8da2fa
10 files changed
+429 -3

No files matched your search

+20
View File
@@ -1189,6 +1189,26 @@ export const actions = [
},
}),
defineAction({
name: 'set_friends_category',
summary: '移动好友到指定分组',
returns: '成功时返回空数据。',
params: {
uin: f.userId().describe('要移动的好友 QQ 号'),
categoryId: f.int({ min: 0 }).optional().describe('目标分组 ID'),
categoryName: f.string({ allowEmpty: false }).optional().describe('目标分组名称(必须唯一且完全匹配)'),
},
rules: (rules) => [rules.exactlyOneOf('categoryId', 'categoryName')],
run: async (params, ctx) => {
await ctx.bridge.apis.contacts.setFriendCategory({
uin: params.uin,
categoryId: params.categoryId,
categoryName: params.categoryName,
});
return okResponse();
},
}),
// get_recent_contact — 最近会话列表(占位)。QQ 原生该接口是内核本地快照
// (getRecentContactListSnapShot),返回带 peerName/remark/lastestMsg 等丰富
// 元信息;SnowLuma 既无对应 SSO/packet wire,自有 message store 也只覆盖