mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-03 00:19:05 +08:00
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { OB11User } from '@/napcat-onebot/index';
|
|
import { OB11Construct } from '@/napcat-onebot/helper/data';
|
|
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
|
|
const SchemaData = Type.Object({
|
|
no_cache: Type.Optional(Type.Union([Type.Boolean(), Type.String()])),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
export default class GetFriendList extends OneBotAction<Payload, OB11User[]> {
|
|
override actionName = ActionName.GetFriendList;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle (_payload: Payload) {
|
|
const buddyMap = await this.core.apis.FriendApi.getBuddyV2SimpleInfoMap();
|
|
const isNocache = typeof _payload.no_cache === 'string' ? _payload.no_cache === 'true' : !!_payload.no_cache;
|
|
await Promise.all(
|
|
Array.from(buddyMap.values()).map(async (buddyInfo) => {
|
|
try {
|
|
const userDetail = await this.core.apis.UserApi.getUserDetailInfo(buddyInfo.coreInfo.uid, isNocache);
|
|
const data = buddyMap.get(buddyInfo.coreInfo.uid);
|
|
if (data) {
|
|
data.qqLevel = userDetail.qqLevel;
|
|
}
|
|
} catch (error) {
|
|
this.core.context.logger.logError('获取好友详细信息失败', error);
|
|
}
|
|
})
|
|
);
|
|
return OB11Construct.friends(Array.from(buddyMap.values()));
|
|
}
|
|
}
|