mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: GetRecentContact 私有标准
This commit is contained in:
parent
231890f78a
commit
11a3341e13
@ -1,4 +1,4 @@
|
|||||||
import { Peer } from "../entities";
|
import { ChatType, Peer } from "../entities";
|
||||||
import { NodeIKernelRecentContactListener } from "../listeners/NodeIKernelRecentContactListener";
|
import { NodeIKernelRecentContactListener } from "../listeners/NodeIKernelRecentContactListener";
|
||||||
import { GeneralCallResult } from "./common";
|
import { GeneralCallResult } from "./common";
|
||||||
export interface FSABRecentContactParams {
|
export interface FSABRecentContactParams {
|
||||||
@ -39,7 +39,13 @@ export interface NodeIKernelRecentContactService {
|
|||||||
errCode: number,
|
errCode: number,
|
||||||
errMsg: string,
|
errMsg: string,
|
||||||
sortedContactList: Array<number>,
|
sortedContactList: Array<number>,
|
||||||
changedList: Array<any>
|
changedList: Array<{
|
||||||
|
remark: any;
|
||||||
|
peerName: any;
|
||||||
|
sendMemberName: any;
|
||||||
|
sendNickName: any;
|
||||||
|
peerUid: string; peerUin: string, msgTime: string, chatType: ChatType, msgId: string
|
||||||
|
}>
|
||||||
}
|
}
|
||||||
}>; // 1 arguments
|
}>; // 1 arguments
|
||||||
|
|
||||||
|
@ -1,12 +1,52 @@
|
|||||||
|
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQUserApi } from '@/core';
|
import { NTQQMsgApi, NTQQUserApi } from '@/core';
|
||||||
|
import { OB11Constructor } from '@/onebot11/constructor';
|
||||||
|
|
||||||
export default class GetRecentContact extends BaseAction<void, any> {
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
count: { type: ['number', 'string'] }
|
||||||
|
}
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
export default class GetRecentContact extends BaseAction<Payload, any> {
|
||||||
actionName = ActionName.GetRecentContact;
|
actionName = ActionName.GetRecentContact;
|
||||||
protected async _handle(payload: void) {
|
PayloadSchema = SchemaData;
|
||||||
//没有效果
|
protected async _handle(payload: Payload) {
|
||||||
return await NTQQUserApi.getRecentContactListSnapShot(10);
|
let ret = await NTQQUserApi.getRecentContactListSnapShot(parseInt((payload.count || 10).toString()));
|
||||||
|
let data = await Promise.all(ret.info.changedList.map(async (t) => {
|
||||||
|
let FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
|
||||||
|
if (FastMsg.msgList.length > 0) {
|
||||||
|
//扩展ret.info.changedList
|
||||||
|
let lastestMsg = await OB11Constructor.message(FastMsg.msgList[0]);
|
||||||
|
return {
|
||||||
|
lastestMsg: lastestMsg,
|
||||||
|
peerUin: t.peerUin,
|
||||||
|
remark: t.remark,
|
||||||
|
msgTime: t.msgTime,
|
||||||
|
chatType: t.chatType,
|
||||||
|
msgId: t.msgId,
|
||||||
|
sendNickName: t.sendNickName,
|
||||||
|
sendMemberName: t.sendMemberName,
|
||||||
|
peerName: t.peerName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
peerUin: t.peerUin,
|
||||||
|
remark: t.remark,
|
||||||
|
msgTime: t.msgTime,
|
||||||
|
chatType: t.chatType,
|
||||||
|
msgId: t.msgId,
|
||||||
|
sendNickName: t.sendNickName,
|
||||||
|
sendMemberName: t.sendMemberName,
|
||||||
|
peerName: t.peerName
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user