mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
chore: 弃用无用代码
This commit is contained in:
parent
962616545c
commit
3296f2daf8
@ -103,18 +103,18 @@ export class NTQQMsgApi {
|
|||||||
const data = await this.core.eventWrapper.CallNormalEvent<
|
const data = await this.core.eventWrapper.CallNormalEvent<
|
||||||
(GroupCode: string, params: GetFileListParam) => Promise<unknown>,
|
(GroupCode: string, params: GetFileListParam) => Promise<unknown>,
|
||||||
(groupFileListResult: onGroupFileInfoUpdateParamType) => void
|
(groupFileListResult: onGroupFileInfoUpdateParamType) => void
|
||||||
>(
|
>(
|
||||||
'NodeIKernelRichMediaService/getGroupFileList',
|
'NodeIKernelRichMediaService/getGroupFileList',
|
||||||
'NodeIKernelMsgListener/onGroupFileInfoUpdate',
|
'NodeIKernelMsgListener/onGroupFileInfoUpdate',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(groupFileListResult: onGroupFileInfoUpdateParamType) => {
|
(groupFileListResult: onGroupFileInfoUpdateParamType) => {
|
||||||
//Developer Mlikiowa Todo: 此处有问题 无法判断是否成功
|
//Developer Mlikiowa Todo: 此处有问题 无法判断是否成功
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
GroupCode,
|
GroupCode,
|
||||||
params,
|
params,
|
||||||
);
|
);
|
||||||
return data[1].item;
|
return data[1].item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,61 +129,6 @@ export class NTQQMsgApi {
|
|||||||
peerUid: peer.peerUid,
|
peerUid: peer.peerUid,
|
||||||
}, msgIds);
|
}, msgIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendMsgV2(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
|
||||||
function generateMsgId() {
|
|
||||||
const timestamp = Math.floor(Date.now() / 1000);
|
|
||||||
const random = Math.floor(Math.random() * Math.pow(2, 32));
|
|
||||||
const buffer = Buffer.alloc(8);
|
|
||||||
buffer.writeUInt32BE(timestamp, 0);
|
|
||||||
buffer.writeUInt32BE(random, 4);
|
|
||||||
const msgId = BigInt('0x' + buffer.toString('hex')).toString();
|
|
||||||
return msgId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 此处有采用Hack方法 利用数据返回正确得到对应消息
|
|
||||||
// 与之前 Peer队列 MsgSeq队列 真正的MsgId并发不同
|
|
||||||
// 谨慎采用 目前测试暂无问题 Developer.Mlikiowa
|
|
||||||
let msgId: string;
|
|
||||||
try {
|
|
||||||
msgId = await this.getMsgUnique(peer.chatType, await this.getServerTime());
|
|
||||||
} catch (error) {
|
|
||||||
//if (!napCatCore.session.getMsgService()['generateMsgUniqueId'])
|
|
||||||
//兜底识别策略V2
|
|
||||||
msgId = generateMsgId().toString();
|
|
||||||
}
|
|
||||||
const data = await this.core.eventWrapper.CallNormalEvent<
|
|
||||||
(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map<any, any>) => Promise<unknown>,
|
|
||||||
(msgList: RawMessage[]) => void
|
|
||||||
>(
|
|
||||||
'NodeIKernelMsgService/sendMsg',
|
|
||||||
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
|
||||||
1,
|
|
||||||
timeout,
|
|
||||||
(msgRecords: RawMessage[]) => {
|
|
||||||
for (const msgRecord of msgRecords) {
|
|
||||||
if (msgRecord.msgId === msgId && msgRecord.sendStatus === 2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
msgId,
|
|
||||||
peer,
|
|
||||||
msgElements,
|
|
||||||
new Map(),
|
|
||||||
);
|
|
||||||
const retMsg = data[1].find(msgRecord => {
|
|
||||||
if (msgRecord.msgId === msgId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return retMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMsgEx(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
|
||||||
//return NTQQMsgApi.sendMsgV1(peer, msgElements, waitComplete, timeout);
|
|
||||||
}
|
|
||||||
async PrepareTempChat(toUserUid: string, GroupCode: string, nickname: string) {
|
async PrepareTempChat(toUserUid: string, GroupCode: string, nickname: string) {
|
||||||
//By Jadx/Ida Mlikiowa
|
//By Jadx/Ida Mlikiowa
|
||||||
const TempGameSession = {
|
const TempGameSession = {
|
||||||
@ -215,29 +160,29 @@ export class NTQQMsgApi {
|
|||||||
await this.PrepareTempChat(peer.peerUid, peer.guildId, member.nick);
|
await this.PrepareTempChat(peer.peerUid, peer.guildId, member.nick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const msgId = await this.getMsgUnique(peer.chatType, await this.getServerTime());
|
const msgId = await this.generateMsgUniqueId(peer.chatType, await this.getServerTime());
|
||||||
peer.guildId = msgId;
|
peer.guildId = msgId;
|
||||||
const data = await this.core.eventWrapper.CallNormalEvent<
|
const data = await this.core.eventWrapper.CallNormalEvent<
|
||||||
(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map<any, any>) => Promise<unknown>,
|
(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map<any, any>) => Promise<unknown>,
|
||||||
(msgList: RawMessage[]) => void
|
(msgList: RawMessage[]) => void
|
||||||
>(
|
>(
|
||||||
'NodeIKernelMsgService/sendMsg',
|
'NodeIKernelMsgService/sendMsg',
|
||||||
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
||||||
1,
|
1,
|
||||||
timeout,
|
timeout,
|
||||||
(msgRecords: RawMessage[]) => {
|
(msgRecords: RawMessage[]) => {
|
||||||
for (const msgRecord of msgRecords) {
|
for (const msgRecord of msgRecords) {
|
||||||
if (msgRecord.guildId === msgId && msgRecord.sendStatus === 2) {
|
if (msgRecord.guildId === msgId && msgRecord.sendStatus === 2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
},
|
return false;
|
||||||
'0',
|
},
|
||||||
peer,
|
'0',
|
||||||
msgElements,
|
peer,
|
||||||
new Map(),
|
msgElements,
|
||||||
);
|
new Map(),
|
||||||
|
);
|
||||||
const retMsg = data[1].find(msgRecord => {
|
const retMsg = data[1].find(msgRecord => {
|
||||||
if (msgRecord.guildId === msgId) {
|
if (msgRecord.guildId === msgId) {
|
||||||
return true;
|
return true;
|
||||||
@ -246,11 +191,8 @@ export class NTQQMsgApi {
|
|||||||
return retMsg;
|
return retMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMsgUnique(chatType: number, time: string) {
|
async generateMsgUniqueId(chatType: number, time: string) {
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
return this.context.session.getMsgService().generateMsgUniqueId(chatType, time);
|
||||||
return this.context.session.getMsgService().generateMsgUniqueId(chatType, time);
|
|
||||||
}
|
|
||||||
return this.context.session.getMsgService().getMsgUniqueId(time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getServerTime() {
|
async getServerTime() {
|
||||||
@ -272,25 +214,25 @@ export class NTQQMsgApi {
|
|||||||
const data = await this.core.eventWrapper.CallNormalEvent<
|
const data = await this.core.eventWrapper.CallNormalEvent<
|
||||||
(msgInfo: typeof msgInfos, srcPeer: Peer, destPeer: Peer, comment: Array<any>, attr: Map<any, any>) => Promise<unknown>,
|
(msgInfo: typeof msgInfos, srcPeer: Peer, destPeer: Peer, comment: Array<any>, attr: Map<any, any>) => Promise<unknown>,
|
||||||
(msgList: RawMessage[]) => void
|
(msgList: RawMessage[]) => void
|
||||||
>(
|
>(
|
||||||
'NodeIKernelMsgService/multiForwardMsgWithComment',
|
'NodeIKernelMsgService/multiForwardMsgWithComment',
|
||||||
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
'NodeIKernelMsgListener/onMsgInfoListUpdate',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(msgRecords: RawMessage[]) => {
|
(msgRecords: RawMessage[]) => {
|
||||||
for (const msgRecord of msgRecords) {
|
for (const msgRecord of msgRecords) {
|
||||||
if (msgRecord.peerUid == destPeer.peerUid && msgRecord.senderUid == this.core.selfInfo.uid) {
|
if (msgRecord.peerUid == destPeer.peerUid && msgRecord.senderUid == this.core.selfInfo.uid) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
},
|
return false;
|
||||||
msgInfos,
|
},
|
||||||
srcPeer,
|
msgInfos,
|
||||||
destPeer,
|
srcPeer,
|
||||||
[],
|
destPeer,
|
||||||
new Map(),
|
[],
|
||||||
);
|
new Map(),
|
||||||
|
);
|
||||||
for (const msg of data[1]) {
|
for (const msg of data[1]) {
|
||||||
const arkElement = msg.elements.find(ele => ele.arkElement);
|
const arkElement = msg.elements.find(ele => ele.arkElement);
|
||||||
if (!arkElement) {
|
if (!arkElement) {
|
||||||
|
@ -231,11 +231,6 @@ export class NTQQUserApi {
|
|||||||
if (uid) return uid;
|
if (uid) return uid;
|
||||||
uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
||||||
if (uid) return uid;
|
if (uid) return uid;
|
||||||
// console.log((await this.core.getApiContext().FriendApi.getBuddyIdMapCache(true)));
|
|
||||||
uid = (await this.core.apis.FriendApi.getBuddyIdMapCache(true)).getValue(Uin);//从Buddy缓存获取Uid
|
|
||||||
if (uid) return uid;
|
|
||||||
uid = (await this.core.apis.FriendApi.getBuddyIdMap(true)).getValue(Uin);
|
|
||||||
if (uid) return uid;
|
|
||||||
const unveifyUid = (await this.getUserDetailInfoByUinV2(Uin)).detail.uid;//从QQ Native 特殊转换
|
const unveifyUid = (await this.getUserDetailInfoByUinV2(Uin)).detail.uid;//从QQ Native 特殊转换
|
||||||
if (unveifyUid.indexOf('*') == -1) uid = unveifyUid;
|
if (unveifyUid.indexOf('*') == -1) uid = unveifyUid;
|
||||||
//if (uid) return uid;
|
//if (uid) return uid;
|
||||||
@ -250,8 +245,6 @@ export class NTQQUserApi {
|
|||||||
if (uin) return uin;
|
if (uin) return uin;
|
||||||
uin = (await this.context.session.getUixConvertService().getUin([Uid])).uinInfo.get(Uid);
|
uin = (await this.context.session.getUixConvertService().getUin([Uid])).uinInfo.get(Uid);
|
||||||
if (uin) return uin;
|
if (uin) return uin;
|
||||||
uin = (await this.core.apis.FriendApi.getBuddyIdMapCache(true)).getKey(Uid);//从Buddy缓存获取Uin
|
|
||||||
if (uin) return uin;
|
|
||||||
uin = (await this.core.apis.FriendApi.getBuddyIdMap(true)).getKey(Uid);
|
uin = (await this.core.apis.FriendApi.getBuddyIdMap(true)).getKey(Uid);
|
||||||
if (uin) return uin;
|
if (uin) return uin;
|
||||||
uin = (await this.getUserDetailInfo(Uid)).uin; //从QQ Native 转换
|
uin = (await this.getUserDetailInfo(Uid)).uin; //从QQ Native 转换
|
||||||
|
@ -9,7 +9,7 @@ export class GetProfileLike extends BaseAction<void, any> {
|
|||||||
const ret = await NTQQUserApi.getProfileLike(this.CoreContext.selfInfo.uid);
|
const ret = await NTQQUserApi.getProfileLike(this.CoreContext.selfInfo.uid);
|
||||||
const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos;
|
const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos;
|
||||||
for (let i = 0; i < listdata.length; i++) {
|
for (let i = 0; i < listdata.length; i++) {
|
||||||
listdata[i].uin = parseInt((await NTQQUserApi.getUinByUid(listdata[i].uid)) || '');
|
listdata[i].uin = parseInt((await NTQQUserApi.getUinByUidV2(listdata[i].uid)) || '');
|
||||||
}
|
}
|
||||||
return listdata;
|
return listdata;
|
||||||
}
|
}
|
||||||
|
@ -24,22 +24,22 @@ export class GetGroupSystemMsg extends BaseAction<void, any> {
|
|||||||
if (SSNotify.type == 1) {
|
if (SSNotify.type == 1) {
|
||||||
retData.InvitedRequest.push({
|
retData.InvitedRequest.push({
|
||||||
request_id: SSNotify.seq,
|
request_id: SSNotify.seq,
|
||||||
invitor_uin: await NTQQUserApi.getUinByUid(SSNotify.user1?.uid),
|
invitor_uin: await NTQQUserApi.getUinByUidV2(SSNotify.user1?.uid),
|
||||||
invitor_nick: SSNotify.user1?.nickName,
|
invitor_nick: SSNotify.user1?.nickName,
|
||||||
group_id: SSNotify.group?.groupCode,
|
group_id: SSNotify.group?.groupCode,
|
||||||
group_name: SSNotify.group?.groupName,
|
group_name: SSNotify.group?.groupName,
|
||||||
checked: SSNotify.status === 1 ? false : true,
|
checked: SSNotify.status === 1 ? false : true,
|
||||||
actor: await NTQQUserApi.getUinByUid(SSNotify.user2?.uid) || 0,
|
actor: await NTQQUserApi.getUinByUidV2(SSNotify.user2?.uid) || 0,
|
||||||
});
|
});
|
||||||
} else if (SSNotify.type == 7) {
|
} else if (SSNotify.type == 7) {
|
||||||
retData.join_requests.push({
|
retData.join_requests.push({
|
||||||
request_id: SSNotify.seq,
|
request_id: SSNotify.seq,
|
||||||
requester_uin: await NTQQUserApi.getUinByUid(SSNotify.user1?.uid),
|
requester_uin: await NTQQUserApi.getUinByUidV2(SSNotify.user1?.uid),
|
||||||
requester_nick: SSNotify.user1?.nickName,
|
requester_nick: SSNotify.user1?.nickName,
|
||||||
group_id: SSNotify.group?.groupCode,
|
group_id: SSNotify.group?.groupCode,
|
||||||
group_name: SSNotify.group?.groupName,
|
group_name: SSNotify.group?.groupName,
|
||||||
checked: SSNotify.status === 1 ? false : true,
|
checked: SSNotify.status === 1 ? false : true,
|
||||||
actor: await NTQQUserApi.getUinByUid(SSNotify.user2?.uid) || 0,
|
actor: await NTQQUserApi.getUinByUidV2(SSNotify.user2?.uid) || 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ export class OB11Constructor {
|
|||||||
const { atNtUid, content } = element.textElement;
|
const { atNtUid, content } = element.textElement;
|
||||||
let atQQ = element.textElement.atUid;
|
let atQQ = element.textElement.atUid;
|
||||||
if (!atQQ || atQQ === '0') {
|
if (!atQQ || atQQ === '0') {
|
||||||
atQQ = await NTQQUserApi.getUinByUid(atNtUid);
|
atQQ = await NTQQUserApi.getUinByUidV2(atNtUid);
|
||||||
}
|
}
|
||||||
if (atQQ) {
|
if (atQQ) {
|
||||||
qq = atQQ as `${number}`;
|
qq = atQQ as `${number}`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user