refactor: ntqqapi types

This commit is contained in:
linyuchen
2024-03-17 11:35:38 +08:00
parent d8e31985af
commit 1a6739ffab
13 changed files with 277 additions and 204 deletions

View File

@@ -4,6 +4,7 @@ import {log, sleep} from "../../common/utils";
import {dbUtil} from "../../common/db";
import {selfInfo} from "../../common/data";
import {ReceiveCmdS, registerReceiveHook} from "../hook";
export let sendMessagePool: Record<string, ((sendSuccessMsg: RawMessage) => void) | null> = {}// peerUid: callbackFunnc
export interface Peer {
@@ -13,12 +14,33 @@ export interface Peer {
}
export class NTQQMsgApi {
static async activateChat(peer: Peer) {
static async activateGroupChat(groupCode: string) {
return await callNTQQApi({
methodName: NTQQApiMethod.ADD_ACTIVE_CHAT,
args: [{peer, cnt: 20}]
args: [{peer:{peerUid: groupCode, chatType: ChatType.group}, cnt: 20}]
})
}
static async fetchRecentContact(){
await callNTQQApi({
methodName: NTQQApiMethod.RECENT_CONTACT,
args: [
{
fetchParam: {
anchorPointContact: {
contactId: '',
sortField: '',
pos: 0,
},
relativeMoveCount: 0,
listType: 2, // 1普通消息2群助手内的消息
count: 200,
fetchOld: true,
},
}
]
})
}
static async recallMsg(peer: Peer, msgIds: string[]) {
return await callNTQQApi({
methodName: NTQQApiMethod.RECALL_MSG,