mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
chore: fix indentation in files
This commit is contained in:
@@ -250,12 +250,13 @@ export class NTQQFileApi {
|
|||||||
}
|
}
|
||||||
const Event = this.core.eventWrapper.createEventFunction<EventType>('NodeIKernelSearchService/searchFileWithKeywords');
|
const Event = this.core.eventWrapper.createEventFunction<EventType>('NodeIKernelSearchService/searchFileWithKeywords');
|
||||||
let id = '';
|
let id = '';
|
||||||
const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void>('NodeIKernelSearchListener/onSearchFileKeywordsResult', 1, 20000, (params) => {
|
const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void>
|
||||||
if (id !== '' && params.searchId == id) {
|
(
|
||||||
return true;
|
'NodeIKernelSearchListener/onSearchFileKeywordsResult',
|
||||||
}
|
1,
|
||||||
return false;
|
20000,
|
||||||
});
|
(params) => id !== '' && params.searchId == id
|
||||||
|
);
|
||||||
id = await Event!(keys, 12);
|
id = await Event!(keys, 12);
|
||||||
const [ret] = (await Listener);
|
const [ret] = (await Listener);
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -1,26 +1,31 @@
|
|||||||
import { FriendV2, User } from '@/core/entities';
|
import { FriendV2, User } from '@/core/entities';
|
||||||
import { BuddyListReqType, InstanceContext, NapCatCore, NodeIKernelProfileService, OnBuddyChangeParams } from '@/core';
|
import { BuddyListReqType, InstanceContext, NapCatCore, NodeIKernelProfileService, OnBuddyChangeParams } from '@/core';
|
||||||
import { LimitedHashTable } from '@/common/utils/MessageUnique';
|
import { LimitedHashTable } from '@/common/utils/MessageUnique';
|
||||||
|
|
||||||
export class NTQQFriendApi {
|
export class NTQQFriendApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBuddyV2(refresh = false): Promise<FriendV2[]> {
|
async getBuddyV2(refresh = false): Promise<FriendV2[]> {
|
||||||
const uids: string[] = [];
|
const uids: string[] = [];
|
||||||
const buddyService = this.context.session.getBuddyService();
|
const buddyService = this.context.session.getBuddyService();
|
||||||
const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL);
|
const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL);
|
||||||
uids.push(...buddyListV2.data.flatMap(item => item.buddyUids));
|
uids.push(...buddyListV2.data.flatMap(item => item.buddyUids));
|
||||||
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
|
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
|
||||||
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids
|
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids,
|
||||||
);
|
);
|
||||||
return Array.from(data.values());
|
return Array.from(data.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBuddyIdMapCache(refresh = false): Promise<LimitedHashTable<string, string>> {
|
async getBuddyIdMapCache(refresh = false): Promise<LimitedHashTable<string, string>> {
|
||||||
return await this.getBuddyIdMap(refresh);
|
return await this.getBuddyIdMap(refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBuddyIdMap(refresh = false): Promise<LimitedHashTable<string, string>> {
|
async getBuddyIdMap(refresh = false): Promise<LimitedHashTable<string, string>> {
|
||||||
const uids: string[] = [];
|
const uids: string[] = [];
|
||||||
const retMap: LimitedHashTable<string, string> = new LimitedHashTable<string, string>(5000);
|
const retMap: LimitedHashTable<string, string> = new LimitedHashTable<string, string>(5000);
|
||||||
@@ -28,7 +33,7 @@ export class NTQQFriendApi {
|
|||||||
const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL);
|
const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL);
|
||||||
uids.push(...buddyListV2.data.flatMap(item => item.buddyUids));
|
uids.push(...buddyListV2.data.flatMap(item => item.buddyUids));
|
||||||
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
|
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
|
||||||
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids
|
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids,
|
||||||
);
|
);
|
||||||
data.forEach((value, key) => {
|
data.forEach((value, key) => {
|
||||||
retMap.set(value.uin!, value.uid!);
|
retMap.set(value.uin!, value.uid!);
|
||||||
@@ -36,6 +41,7 @@ export class NTQQFriendApi {
|
|||||||
//console.log('getBuddyIdMap', retMap.getValue);
|
//console.log('getBuddyIdMap', retMap.getValue);
|
||||||
return retMap;
|
return retMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBuddyV2ExWithCate(refresh = false) {
|
async getBuddyV2ExWithCate(refresh = false) {
|
||||||
const uids: string[] = [];
|
const uids: string[] = [];
|
||||||
const categoryMap: Map<string, any> = new Map();
|
const categoryMap: Map<string, any> = new Map();
|
||||||
@@ -49,31 +55,36 @@ export class NTQQFriendApi {
|
|||||||
return item.buddyUids;
|
return item.buddyUids;
|
||||||
}));
|
}));
|
||||||
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
|
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
|
||||||
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids
|
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids,
|
||||||
);
|
);
|
||||||
return Array.from(data).map(([key, value]) => {
|
return Array.from(data).map(([key, value]) => {
|
||||||
const category = categoryMap.get(key);
|
const category = categoryMap.get(key);
|
||||||
return category ? { ...value, categoryId: category.categoryId, categroyName: category.categroyName } : value;
|
return category ? {
|
||||||
|
...value,
|
||||||
|
categoryId: category.categoryId,
|
||||||
|
categroyName: category.categroyName,
|
||||||
|
} : value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async isBuddy(uid: string) {
|
async isBuddy(uid: string) {
|
||||||
return this.context.session.getBuddyService().isBuddy(uid);
|
return this.context.session.getBuddyService().isBuddy(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @param forced
|
* @param forced
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getFriends(forced = false): Promise<User[]> {
|
async getFriends(forced = false): Promise<User[]> {
|
||||||
const [_retData, _BuddyArg] = await this.core.eventWrapper.CallNormalEvent
|
const [_retData, _BuddyArg] = await this.core.eventWrapper.CallNormalEvent<(force: boolean) => Promise<any>, (arg: OnBuddyChangeParams) => void>
|
||||||
<(force: boolean) => Promise<any>, (arg: OnBuddyChangeParams) => void>
|
|
||||||
(
|
(
|
||||||
'NodeIKernelBuddyService/getBuddyList',
|
'NodeIKernelBuddyService/getBuddyList',
|
||||||
'NodeIKernelBuddyListener/onBuddyListChange',
|
'NodeIKernelBuddyListener/onBuddyListChange',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
() => true,
|
() => true,
|
||||||
forced
|
forced,
|
||||||
);
|
);
|
||||||
const friends: User[] = [];
|
const friends: User[] = [];
|
||||||
for (const categoryItem of _BuddyArg) {
|
for (const categoryItem of _BuddyArg) {
|
||||||
@@ -94,7 +105,7 @@ export class NTQQFriendApi {
|
|||||||
this.context.session.getBuddyService()?.approvalFriendRequest({
|
this.context.session.getBuddyService()?.approvalFriendRequest({
|
||||||
friendUid: friendUid,
|
friendUid: friendUid,
|
||||||
reqTime: reqTime,
|
reqTime: reqTime,
|
||||||
accept
|
accept,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,34 +1,46 @@
|
|||||||
import { GroupMember, GroupRequestOperateTypes, GroupMemberRole, GroupNotify, Group, MemberExtSourceType, GroupNotifyTypes, ChatType, Peer, GroupListUpdateType } from '../entities';
|
import {
|
||||||
|
ChatType,
|
||||||
|
GroupMember,
|
||||||
|
GroupMemberRole,
|
||||||
|
GroupNotify,
|
||||||
|
GroupRequestOperateTypes,
|
||||||
|
MemberExtSourceType,
|
||||||
|
} from '../entities';
|
||||||
import { GeneralCallResult, InstanceContext, NapCatCore, NodeIKernelGroupService } from '@/core';
|
import { GeneralCallResult, InstanceContext, NapCatCore, NodeIKernelGroupService } from '@/core';
|
||||||
import { runAllWithTimeout } from '@/common/utils/helper';
|
import { runAllWithTimeout } from '@/common/utils/helper';
|
||||||
import { NodeIKernelGroupListener } from '../listeners';
|
import { NodeIKernelGroupListener } from '../listeners';
|
||||||
|
|
||||||
export class NTQQGroupApi {
|
export class NTQQGroupApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
async setGroupAvatar(gc: string, filePath: string) {
|
async setGroupAvatar(gc: string, filePath: string) {
|
||||||
return this.context.session.getGroupService().setHeader(gc, filePath);
|
return this.context.session.getGroupService().setHeader(gc, filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroups(forced = false) {
|
async getGroups(forced = false) {
|
||||||
type ListenerType = NodeIKernelGroupListener['onGroupListUpdate'];
|
type ListenerType = NodeIKernelGroupListener['onGroupListUpdate'];
|
||||||
const [_retData, _updateType, groupList] = await this.core.eventWrapper.CallNormalEvent
|
const [_retData, _updateType, groupList] = await this.core.eventWrapper.CallNormalEvent <(force: boolean) => Promise<any>, ListenerType>
|
||||||
<(force: boolean) => Promise<any>, ListenerType>
|
|
||||||
(
|
(
|
||||||
'NodeIKernelGroupService/getGroupList',
|
'NodeIKernelGroupService/getGroupList',
|
||||||
'NodeIKernelGroupListener/onGroupListUpdate',
|
'NodeIKernelGroupListener/onGroupListUpdate',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(updateType) => true,
|
(updateType) => true,
|
||||||
forced
|
forced,
|
||||||
);
|
);
|
||||||
return groupList;
|
return groupList;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMemberLatestSendTimeCache(GroupCode: string, uids: string[]) {
|
async getGroupMemberLatestSendTimeCache(GroupCode: string, uids: string[]) {
|
||||||
return this.getGroupMemberLatestSendTime(GroupCode, uids);
|
return this.getGroupMemberLatestSendTime(GroupCode, uids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过QQ自带数据库获取群成员最后发言时间(仅返回有效数据 且消耗延迟大 需要进行缓存)
|
* 通过QQ自带数据库获取群成员最后发言时间(仅返回有效数据 且消耗延迟大 需要进行缓存)
|
||||||
* @param GroupCode 群号
|
* @param GroupCode 群号
|
||||||
@@ -38,7 +50,7 @@ export class NTQQGroupApi {
|
|||||||
* for (let [uin, sendTime] of ret) {
|
* for (let [uin, sendTime] of ret) {
|
||||||
* console.log(uin, sendTime);
|
* console.log(uin, sendTime);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
async getGroupMemberLatestSendTime(GroupCode: string, uids: string[]) {
|
async getGroupMemberLatestSendTime(GroupCode: string, uids: string[]) {
|
||||||
const getdata = async (uid: string) => {
|
const getdata = async (uid: string) => {
|
||||||
const NTRet = await this.getLatestMsgByUids(GroupCode, [uid]);
|
const NTRet = await this.getLatestMsgByUids(GroupCode, [uid]);
|
||||||
@@ -63,6 +75,7 @@ export class NTQQGroupApi {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLatestMsgByUids(GroupCode: string, uids: string[]) {
|
async getLatestMsgByUids(GroupCode: string, uids: string[]) {
|
||||||
const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
||||||
chatInfo: {
|
chatInfo: {
|
||||||
@@ -79,9 +92,11 @@ export class NTQQGroupApi {
|
|||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMemberAll(GroupCode: string, forced = false) {
|
async getGroupMemberAll(GroupCode: string, forced = false) {
|
||||||
return this.context.session.getGroupService().getAllMemberList(GroupCode, forced);
|
return this.context.session.getGroupService().getAllMemberList(GroupCode, forced);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLatestMsg(GroupCode: string, uins: string[]) {
|
async getLatestMsg(GroupCode: string, uins: string[]) {
|
||||||
const uids: Array<string> = [];
|
const uids: Array<string> = [];
|
||||||
for (const uin of uins) {
|
for (const uin of uins) {
|
||||||
@@ -105,45 +120,59 @@ export class NTQQGroupApi {
|
|||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupRecommendContactArkJson(GroupCode: string) {
|
async getGroupRecommendContactArkJson(GroupCode: string) {
|
||||||
return this.context.session.getGroupService().getGroupRecommendContactArkJson(GroupCode);
|
return this.context.session.getGroupService().getGroupRecommendContactArkJson(GroupCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
async CreatGroupFileFolder(groupCode: string, folderName: string) {
|
async CreatGroupFileFolder(groupCode: string, folderName: string) {
|
||||||
return this.context.session.getRichMediaService().createGroupFolder(groupCode, folderName);
|
return this.context.session.getRichMediaService().createGroupFolder(groupCode, folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
async DelGroupFile(groupCode: string, files: string[]) {
|
async DelGroupFile(groupCode: string, files: string[]) {
|
||||||
return this.context.session.getRichMediaService().deleteGroupFile(groupCode, [102], files);
|
return this.context.session.getRichMediaService().deleteGroupFile(groupCode, [102], files);
|
||||||
}
|
}
|
||||||
|
|
||||||
async DelGroupFileFolder(groupCode: string, folderId: string) {
|
async DelGroupFileFolder(groupCode: string, folderId: string) {
|
||||||
return this.context.session.getRichMediaService().deleteGroupFolder(groupCode, folderId);
|
return this.context.session.getRichMediaService().deleteGroupFolder(groupCode, folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addGroupEssence(GroupCode: string, msgId: string) {
|
async addGroupEssence(GroupCode: string, msgId: string) {
|
||||||
// 代码没测过
|
// 代码没测过
|
||||||
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
||||||
const MsgData = await this.context.session.getMsgService().getMsgsIncludeSelf({ chatType: 2, guildId: '', peerUid: GroupCode }, msgId, 1, false);
|
const MsgData = await this.context.session.getMsgService().getMsgsIncludeSelf({
|
||||||
|
chatType: 2,
|
||||||
|
guildId: '',
|
||||||
|
peerUid: GroupCode,
|
||||||
|
}, msgId, 1, false);
|
||||||
const param = {
|
const param = {
|
||||||
groupCode: GroupCode,
|
groupCode: GroupCode,
|
||||||
msgRandom: parseInt(MsgData.msgList[0].msgRandom),
|
msgRandom: parseInt(MsgData.msgList[0].msgRandom),
|
||||||
msgSeq: parseInt(MsgData.msgList[0].msgSeq)
|
msgSeq: parseInt(MsgData.msgList[0].msgSeq),
|
||||||
};
|
};
|
||||||
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
||||||
return this.context.session.getGroupService().addGroupEssence(param);
|
return this.context.session.getGroupService().addGroupEssence(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeGroupEssence(GroupCode: string, msgId: string) {
|
async removeGroupEssence(GroupCode: string, msgId: string) {
|
||||||
// 代码没测过
|
// 代码没测过
|
||||||
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
||||||
const MsgData = await this.context.session.getMsgService().getMsgsIncludeSelf({ chatType: 2, guildId: '', peerUid: GroupCode }, msgId, 1, false);
|
const MsgData = await this.context.session.getMsgService().getMsgsIncludeSelf({
|
||||||
|
chatType: 2,
|
||||||
|
guildId: '',
|
||||||
|
peerUid: GroupCode,
|
||||||
|
}, msgId, 1, false);
|
||||||
const param = {
|
const param = {
|
||||||
groupCode: GroupCode,
|
groupCode: GroupCode,
|
||||||
msgRandom: parseInt(MsgData.msgList[0].msgRandom),
|
msgRandom: parseInt(MsgData.msgList[0].msgRandom),
|
||||||
msgSeq: parseInt(MsgData.msgList[0].msgSeq)
|
msgSeq: parseInt(MsgData.msgList[0].msgSeq),
|
||||||
};
|
};
|
||||||
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
||||||
return this.context.session.getGroupService().removeGroupEssence(param);
|
return this.context.session.getGroupService().removeGroupEssence(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSingleScreenNotifies(num: number) {
|
async getSingleScreenNotifies(num: number) {
|
||||||
const [_retData, _doubt, _seq, notifies] = await this.core.eventWrapper.CallNormalEvent
|
const [_retData, _doubt, _seq, notifies] = await this.core.eventWrapper.CallNormalEvent <(arg1: boolean, arg2: string, arg3: number) => Promise<any>, (doubt: boolean, seq: string, notifies: GroupNotify[]) => void>
|
||||||
<(arg1: boolean, arg2: string, arg3: number) => Promise<any>, (doubt: boolean, seq: string, notifies: GroupNotify[]) => void>
|
|
||||||
(
|
(
|
||||||
'NodeIKernelGroupService/getSingleScreenNotifies',
|
'NodeIKernelGroupService/getSingleScreenNotifies',
|
||||||
'NodeIKernelGroupListener/onGroupSingleScreenNotifies',
|
'NodeIKernelGroupListener/onGroupSingleScreenNotifies',
|
||||||
@@ -152,17 +181,17 @@ export class NTQQGroupApi {
|
|||||||
() => true,
|
() => true,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
num
|
num,
|
||||||
);
|
);
|
||||||
return notifies;
|
return notifies;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMemberV2(GroupCode: string, uid: string, forced = false) {
|
async getGroupMemberV2(GroupCode: string, uid: string, forced = false) {
|
||||||
type ListenerType = NodeIKernelGroupListener['onMemberInfoChange'];
|
type ListenerType = NodeIKernelGroupListener['onMemberInfoChange'];
|
||||||
type EventType = NodeIKernelGroupService['getMemberInfo'];
|
type EventType = NodeIKernelGroupService['getMemberInfo'];
|
||||||
// NTEventDispatch.CreatListenerFunction('NodeIKernelGroupListener/onGroupMemberInfoUpdate',
|
// NTEventDispatch.CreatListenerFunction('NodeIKernelGroupListener/onGroupMemberInfoUpdate',
|
||||||
//return napCatCore.session.getGroupService().getMemberInfo(GroupCode, [uid], forced);
|
//return napCatCore.session.getGroupService().getMemberInfo(GroupCode, [uid], forced);
|
||||||
const [ret, _groupCode, _changeType, _members] = await this.core.eventWrapper.CallNormalEvent
|
const [ret, _groupCode, _changeType, _members] = await this.core.eventWrapper.CallNormalEvent <EventType, ListenerType>
|
||||||
<EventType, ListenerType>
|
|
||||||
(
|
(
|
||||||
'NodeIKernelGroupService/getMemberInfo',
|
'NodeIKernelGroupService/getMemberInfo',
|
||||||
'NodeIKernelGroupListener/onMemberInfoChange',
|
'NodeIKernelGroupListener/onMemberInfoChange',
|
||||||
@@ -171,10 +200,11 @@ export class NTQQGroupApi {
|
|||||||
(groupCode: string, changeType: number, members: Map<string, GroupMember>) => {
|
(groupCode: string, changeType: number, members: Map<string, GroupMember>) => {
|
||||||
return groupCode == GroupCode && members.has(uid);
|
return groupCode == GroupCode && members.has(uid);
|
||||||
},
|
},
|
||||||
GroupCode, [uid], forced
|
GroupCode, [uid], forced,
|
||||||
);
|
);
|
||||||
return _members.get(uid);
|
return _members.get(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
||||||
const groupService = this.context.session.getGroupService();
|
const groupService = this.context.session.getGroupService();
|
||||||
const sceneId = groupService.createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
const sceneId = groupService.createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
||||||
@@ -199,25 +229,31 @@ export class NTQQGroupApi {
|
|||||||
// 加群通知,退出通知,需要管理员权限
|
// 加群通知,退出通知,需要管理员权限
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetGroupFileCount(Gids: Array<string>) {
|
async GetGroupFileCount(Gids: Array<string>) {
|
||||||
return this.context.session.getRichMediaService().batchGetGroupFileCount(Gids);
|
return this.context.session.getRichMediaService().batchGetGroupFileCount(Gids);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupIgnoreNotifies() {
|
async getGroupIgnoreNotifies() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getArkJsonGroupShare(GroupCode: string) {
|
async getArkJsonGroupShare(GroupCode: string) {
|
||||||
const ret = await this.core.eventWrapper.callNoListenerEvent
|
const ret = await this.core.eventWrapper.callNoListenerEvent<(GroupId: string) => Promise<GeneralCallResult & {
|
||||||
<(GroupId: string) => Promise<GeneralCallResult & { arkJson: string }>>(
|
arkJson: string
|
||||||
|
}>>(
|
||||||
'NodeIKernelGroupService/getGroupRecommendContactArkJson',
|
'NodeIKernelGroupService/getGroupRecommendContactArkJson',
|
||||||
5000,
|
5000,
|
||||||
GroupCode
|
GroupCode,
|
||||||
);
|
);
|
||||||
return ret.arkJson;
|
return ret.arkJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
async uploadGroupBulletinPic(GroupCode: string, imageurl: string) {
|
async uploadGroupBulletinPic(GroupCode: string, imageurl: string) {
|
||||||
const _Pskey = (await this.core.getApiContext().UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
const _Pskey = (await this.core.getApiContext().UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
||||||
return this.context.session.getGroupService().uploadGroupBulletinPic(GroupCode, _Pskey, imageurl);
|
return this.context.session.getGroupService().uploadGroupBulletinPic(GroupCode, _Pskey, imageurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleGroupRequest(flag: string, operateType: GroupRequestOperateTypes, reason?: string) {
|
async handleGroupRequest(flag: string, operateType: GroupRequestOperateTypes, reason?: string) {
|
||||||
const flagitem = flag.split('|');
|
const flagitem = flag.split('|');
|
||||||
const groupCode = flagitem[0];
|
const groupCode = flagitem[0];
|
||||||
@@ -232,8 +268,8 @@ export class NTQQGroupApi {
|
|||||||
'seq': seq, // 通知序列号
|
'seq': seq, // 通知序列号
|
||||||
'type': type,
|
'type': type,
|
||||||
'groupCode': groupCode,
|
'groupCode': groupCode,
|
||||||
'postscript': reason || ' ' // 仅传空值可能导致处理失败,故默认给个空格
|
'postscript': reason || ' ', // 仅传空值可能导致处理失败,故默认给个空格
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +307,11 @@ export class NTQQGroupApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async publishGroupBulletin(groupQQ: string, content: string, picInfo: { id: string, width: number, height: number } | undefined = undefined, pinned: number = 0, confirmRequired: number = 0,) {
|
async publishGroupBulletin(groupQQ: string, content: string, picInfo: {
|
||||||
|
id: string,
|
||||||
|
width: number,
|
||||||
|
height: number
|
||||||
|
} | undefined = undefined, pinned: number = 0, confirmRequired: number = 0) {
|
||||||
const _Pskey = (await this.core.getApiContext().UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com');
|
const _Pskey = (await this.core.getApiContext().UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com');
|
||||||
//text是content内容url编码
|
//text是content内容url编码
|
||||||
const data = {
|
const data = {
|
||||||
@@ -279,13 +319,15 @@ export class NTQQGroupApi {
|
|||||||
picInfo: picInfo,
|
picInfo: picInfo,
|
||||||
oldFeedsId: '',
|
oldFeedsId: '',
|
||||||
pinned: pinned,
|
pinned: pinned,
|
||||||
confirmRequired: confirmRequired
|
confirmRequired: confirmRequired,
|
||||||
};
|
};
|
||||||
return this.context.session.getGroupService().publishGroupBulletin(groupQQ, _Pskey!, data);
|
return this.context.session.getGroupService().publishGroupBulletin(groupQQ, _Pskey!, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupRemainAtTimes(GroupCode: string) {
|
async getGroupRemainAtTimes(GroupCode: string) {
|
||||||
this.context.session.getGroupService().getGroupRemainAtTimes(GroupCode);
|
this.context.session.getGroupService().getGroupRemainAtTimes(GroupCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMemberExtInfo(groupCode: string, uin: string) {
|
async getMemberExtInfo(groupCode: string, uin: string) {
|
||||||
// 仅NTQQ 9.9.11 24568测试 容易炸开谨慎使用
|
// 仅NTQQ 9.9.11 24568测试 容易炸开谨慎使用
|
||||||
return this.context.session.getGroupService().getMemberExtInfo(
|
return this.context.session.getGroupService().getMemberExtInfo(
|
||||||
@@ -317,9 +359,9 @@ export class NTQQGroupApi {
|
|||||||
msgNeedField: 1,
|
msgNeedField: 1,
|
||||||
cmdUinFlagExt3Grocery: 1,
|
cmdUinFlagExt3Grocery: 1,
|
||||||
memberIcon: 1,
|
memberIcon: 1,
|
||||||
memberInfoSeq: 1
|
memberInfoSeq: 1,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
import { RequestUtil } from '@/common/utils/request';
|
import { RequestUtil } from '@/common/utils/request';
|
||||||
import { MiniAppLuaJsonType } from '../entities/sign';
|
import { MiniAppLuaJsonType } from '@/core';
|
||||||
import { InstanceContext, NapCatCore } from '..';
|
import { InstanceContext, NapCatCore } from '..';
|
||||||
|
|
||||||
// let t = await napCatCore.session.getGroupService().shareDigest({
|
// let t = await napCatCore.session.getGroupService().shareDigest({
|
||||||
@@ -73,14 +72,17 @@ import { InstanceContext, NapCatCore } from '..';
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
export class NTQQMusicSignApi {
|
export class NTQQMusicSignApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
async SignMiniApp(CardData: MiniAppLuaJsonType) {
|
|
||||||
|
async signMiniApp(CardData: MiniAppLuaJsonType) {
|
||||||
// {
|
// {
|
||||||
// "app": "com.tencent.miniapp.lua",
|
// "app": "com.tencent.miniapp.lua",
|
||||||
// "bizsrc": "tianxuan.imgJumpArk",
|
// "bizsrc": "tianxuan.imgJumpArk",
|
||||||
@@ -128,26 +130,26 @@ export class NTQQMusicSignApi {
|
|||||||
// return hash & 0x7fffffff;
|
// return hash & 0x7fffffff;
|
||||||
// }
|
// }
|
||||||
const signCard = {
|
const signCard = {
|
||||||
"app": "com.tencent.miniapp.lua",
|
'app': 'com.tencent.miniapp.lua',
|
||||||
"bizsrc": "tianxuan.imgJumpArk",
|
'bizsrc': 'tianxuan.imgJumpArk',
|
||||||
"view": "miniapp",
|
'view': 'miniapp',
|
||||||
"prompt": CardData.prompt,
|
'prompt': CardData.prompt,
|
||||||
"config": {
|
'config': {
|
||||||
"type": "normal",
|
'type': 'normal',
|
||||||
"forward": 1,
|
'forward': 1,
|
||||||
"autosize": 0
|
'autosize': 0,
|
||||||
|
},
|
||||||
|
'meta': {
|
||||||
|
'miniapp': {
|
||||||
|
'title': CardData.title,
|
||||||
|
'preview': (CardData.preview as string).replace(/\\/g, '\\/\\/'),
|
||||||
|
'jumpUrl': (CardData.jumpUrl as string).replace(/\\/g, '\\/\\/'),
|
||||||
|
'tag': CardData.tag,
|
||||||
|
'tagIcon': (CardData.tagIcon as string).replace(/\\/g, '\\/\\/'),
|
||||||
|
'source': CardData.source,
|
||||||
|
'sourcelogo': (CardData.sourcelogo as string).replace(/\\/g, '\\/\\/'),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"meta": {
|
|
||||||
"miniapp": {
|
|
||||||
"title": CardData.title,
|
|
||||||
"preview": (CardData.preview as string).replace(/\\/g, "\\/\\/"),
|
|
||||||
"jumpUrl": (CardData.jumpUrl as string).replace(/\\/g, "\\/\\/"),
|
|
||||||
"tag": CardData.tag,
|
|
||||||
"tagIcon": (CardData.tagIcon as string).replace(/\\/g, "\\/\\/"),
|
|
||||||
"source": CardData.source,
|
|
||||||
"sourcelogo": (CardData.sourcelogo as string).replace(/\\/g, "\\/\\/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
// let signCard = {
|
// let signCard = {
|
||||||
// "app": "com.tencent.eventshare.lua",
|
// "app": "com.tencent.eventshare.lua",
|
||||||
@@ -188,10 +190,13 @@ export class NTQQMusicSignApi {
|
|||||||
|
|
||||||
const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + this.core.selfInfo.uin + '; uin=o' + this.core.selfInfo.uin;
|
const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + this.core.selfInfo.uin + '; uin=o' + this.core.selfInfo.uin;
|
||||||
|
|
||||||
const signurl = "https://h5.qzone.qq.com/v2/vip/tx/trpc/ark-share/GenNewSignedArk?g_tk=" + Bkn + "&ark=" + encodeURIComponent(JSON.stringify(signCard));
|
const signurl = 'https://h5.qzone.qq.com/v2/vip/tx/trpc/ark-share/GenNewSignedArk?g_tk=' + Bkn + '&ark=' + encodeURIComponent(JSON.stringify(signCard));
|
||||||
let signed_ark = "";
|
let signed_ark = '';
|
||||||
try {
|
try {
|
||||||
const retData = await RequestUtil.HttpGetJson<{ code: number, data: { signed_ark: string } }>(signurl, 'GET', undefined, { Cookie: CookieValue });
|
const retData = await RequestUtil.HttpGetJson<{
|
||||||
|
code: number,
|
||||||
|
data: { signed_ark: string }
|
||||||
|
}>(signurl, 'GET', undefined, { Cookie: CookieValue });
|
||||||
//logDebug('MiniApp JSON 消息生成成功', retData);
|
//logDebug('MiniApp JSON 消息生成成功', retData);
|
||||||
signed_ark = retData.data.signed_ark;
|
signed_ark = retData.data.signed_ark;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -199,76 +204,92 @@ export class NTQQMusicSignApi {
|
|||||||
}
|
}
|
||||||
return signed_ark;
|
return signed_ark;
|
||||||
}
|
}
|
||||||
async SignMusicInternal(songname: string, singer: string, cover: string, songmid: string, songmusic: string) {
|
|
||||||
|
async signInternal(songname: string, singer: string, cover: string, songmid: string, songmusic: string) {
|
||||||
//curl -X POST 'https://mqq.reader.qq.com/api/mqq/share/card?accessToken&_csrfToken&source=c0003' -H 'Content-Type: application/json' -H 'Cookie: uin=o10086' -d '{"app":"com.tencent.qqreader.share","config":{"ctime":1718634110,"forward":1,"token":"9a63343c32d5a16bcde653eb97faa25d","type":"normal"},"extra":{"app_type":1,"appid":100497308,"msg_seq":14386738075403815000.0,"uin":1733139081},"meta":{"music":{"action":"","android_pkg_name":"","app_type":1,"appid":100497308,"ctime":1718634110,"desc":"周杰伦","jumpUrl":"https://i.y.qq.com/v8/playsong.html?songmid=0039MnYb0qxYhV&type=0","musicUrl":"http://ws.stream.qqmusic.qq.com/http://isure6.stream.qqmusic.qq.com/M800002202B43Cq4V4.mp3?fromtag=810033622&guid=br_xzg&trace=23fe7bcbe2336bbf&uin=553&vkey=CF0F5CE8B0FA16F3001F8A88D877A217EB5E4F00BDCEF1021EB6C48969CA33C6303987AEECE9CC840122DD2F917A59D6130D8A8CA4577C87","preview":"https://y.qq.com/music/photo_new/T002R800x800M000000MkMni19ClKG.jpg","cover":"https://y.qq.com/music/photo_new/T002R800x800M000000MkMni19ClKG.jpg","sourceMsgId":"0","source_icon":"https://p.qpic.cn/qqconnect/0/app_100497308_1626060999/100?max-age=2592000&t=0","source_url":"","tag":"QQ音乐","title":"晴天","uin":10086}},"prompt":"[分享]晴天","ver":"0.0.0.1","view":"music"}'
|
//curl -X POST 'https://mqq.reader.qq.com/api/mqq/share/card?accessToken&_csrfToken&source=c0003' -H 'Content-Type: application/json' -H 'Cookie: uin=o10086' -d '{"app":"com.tencent.qqreader.share","config":{"ctime":1718634110,"forward":1,"token":"9a63343c32d5a16bcde653eb97faa25d","type":"normal"},"extra":{"app_type":1,"appid":100497308,"msg_seq":14386738075403815000.0,"uin":1733139081},"meta":{"music":{"action":"","android_pkg_name":"","app_type":1,"appid":100497308,"ctime":1718634110,"desc":"周杰伦","jumpUrl":"https://i.y.qq.com/v8/playsong.html?songmid=0039MnYb0qxYhV&type=0","musicUrl":"http://ws.stream.qqmusic.qq.com/http://isure6.stream.qqmusic.qq.com/M800002202B43Cq4V4.mp3?fromtag=810033622&guid=br_xzg&trace=23fe7bcbe2336bbf&uin=553&vkey=CF0F5CE8B0FA16F3001F8A88D877A217EB5E4F00BDCEF1021EB6C48969CA33C6303987AEECE9CC840122DD2F917A59D6130D8A8CA4577C87","preview":"https://y.qq.com/music/photo_new/T002R800x800M000000MkMni19ClKG.jpg","cover":"https://y.qq.com/music/photo_new/T002R800x800M000000MkMni19ClKG.jpg","sourceMsgId":"0","source_icon":"https://p.qpic.cn/qqconnect/0/app_100497308_1626060999/100?max-age=2592000&t=0","source_url":"","tag":"QQ音乐","title":"晴天","uin":10086}},"prompt":"[分享]晴天","ver":"0.0.0.1","view":"music"}'
|
||||||
const signurl = 'https://mqq.reader.qq.com/api/mqq/share/card?accessToken&_csrfToken&source=c0003';
|
const signurl = 'https://mqq.reader.qq.com/api/mqq/share/card?accessToken&_csrfToken&source=c0003';
|
||||||
//let = "https://y.qq.com/music/photo_new/T002R800x800M000000MkMni19ClKG.jpg";
|
//let = "https://y.qq.com/music/photo_new/T002R800x800M000000MkMni19ClKG.jpg";
|
||||||
const signCard = {
|
const signCard = {
|
||||||
app: "com.tencent.qqreader.share",
|
app: 'com.tencent.qqreader.share',
|
||||||
config: {
|
config: {
|
||||||
ctime: 1718634110,
|
ctime: 1718634110,
|
||||||
forward: 1,
|
forward: 1,
|
||||||
token: "9a63343c32d5a16bcde653eb97faa25d",
|
token: '9a63343c32d5a16bcde653eb97faa25d',
|
||||||
type: "normal"
|
type: 'normal',
|
||||||
},
|
},
|
||||||
extra: {
|
extra: {
|
||||||
app_type: 1,
|
app_type: 1,
|
||||||
appid: 100497308,
|
appid: 100497308,
|
||||||
msg_seq: 14386738075403815000.0,
|
msg_seq: 14386738075403815000,
|
||||||
uin: 1733139081
|
uin: 1733139081,
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
music:
|
music: {
|
||||||
{
|
action: '',
|
||||||
action: "",
|
android_pkg_name: '',
|
||||||
android_pkg_name: "",
|
|
||||||
app_type: 1,
|
app_type: 1,
|
||||||
appid: 100497308,
|
appid: 100497308,
|
||||||
ctime: 1718634110,
|
ctime: 1718634110,
|
||||||
desc: singer,
|
desc: singer,
|
||||||
jumpUrl: "https://i.y.qq.com/v8/playsong.html?songmid=" + songmid + "&type=0",
|
jumpUrl: 'https://i.y.qq.com/v8/playsong.html?songmid=' + songmid + '&type=0',
|
||||||
musicUrl: songmusic,
|
musicUrl: songmusic,
|
||||||
preview: cover,
|
preview: cover,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
sourceMsgId: "0",
|
sourceMsgId: '0',
|
||||||
source_icon: "https://p.qpic.cn/qqconnect/0/app_100497308_1626060999/100?max-age=2592000&t=0",
|
source_icon: 'https://p.qpic.cn/qqconnect/0/app_100497308_1626060999/100?max-age=2592000&t=0',
|
||||||
source_url: "",
|
source_url: '',
|
||||||
tag: "QQ音乐",
|
tag: 'QQ音乐',
|
||||||
title: songname,
|
title: songname,
|
||||||
uin: 10086
|
uin: 10086,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
prompt: "[分享]" + songname,
|
},
|
||||||
ver: "0.0.0.1",
|
prompt: '[分享]' + songname,
|
||||||
view: "music"
|
ver: '0.0.0.1',
|
||||||
|
view: 'music',
|
||||||
};
|
};
|
||||||
//console.log(JSON.stringify(signCard, null, 2));
|
//console.log(JSON.stringify(signCard, null, 2));
|
||||||
const data = await RequestUtil.HttpGetJson<{ code: number, data: { arkResult: string } }>
|
const data = await RequestUtil.HttpGetJson<{ code: number, data: { arkResult: string } }>
|
||||||
(signurl, 'POST', signCard, { 'Cookie': 'uin=o10086', 'Content-Type': 'application/json' });
|
(signurl, 'POST', signCard, { 'Cookie': 'uin=o10086', 'Content-Type': 'application/json' });
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//注意处理错误
|
//注意处理错误
|
||||||
async CreateMusicThridWay0(id: string = '', mid: string = '') {
|
async signWay03(id: string = '', mid: string = '') {
|
||||||
|
let signedMid;
|
||||||
if (mid == '') {
|
if (mid == '') {
|
||||||
const MusicInfo = await RequestUtil.HttpGetJson
|
const MusicInfo = await RequestUtil.HttpGetJson<{
|
||||||
<{ songinfo?: { data?: { track_info: { mid: string } } } }>
|
songinfo?: {
|
||||||
(
|
data?: {
|
||||||
|
track_info: {
|
||||||
|
mid: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}>(
|
||||||
'https://u.y.qq.com/cgi-bin/musicu.fcg?format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0&data={"comm":{"ct":24,"cv":0},"songinfo":{"method":"get_song_detail_yqq","param":{"song_type":0,"song_mid":"","song_id":' + id + '},"module":"music.pf_song_detail_svr"}}',
|
'https://u.y.qq.com/cgi-bin/musicu.fcg?format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0&data={"comm":{"ct":24,"cv":0},"songinfo":{"method":"get_song_detail_yqq","param":{"song_type":0,"song_mid":"","song_id":' + id + '},"module":"music.pf_song_detail_svr"}}',
|
||||||
'GET',
|
'GET',
|
||||||
undefined
|
undefined,
|
||||||
);
|
);
|
||||||
mid = MusicInfo.songinfo?.data?.track_info.mid!;
|
signedMid = MusicInfo.songinfo?.data?.track_info.mid;
|
||||||
}
|
}
|
||||||
//第三方接口 存在速率限制 现在勉强用
|
//第三方接口 存在速率限制 现在勉强用
|
||||||
const MusicReal = await RequestUtil.HttpGetJson
|
const MusicReal = await RequestUtil.HttpGetJson<{
|
||||||
<{ code: number, data?: { name: string, singer: string, url: string, cover: string } }>
|
code: number,
|
||||||
('https://api.leafone.cn/api/qqmusic?id=' + mid + '&type=8', 'GET', undefined);
|
data?: {
|
||||||
//console.log(MusicReal);
|
name: string,
|
||||||
return { ...MusicReal.data, mid: mid };
|
singer: string,
|
||||||
|
url: string,
|
||||||
|
cover: string
|
||||||
}
|
}
|
||||||
async CreateMusicThridWay1(id: string = '', mid: string = '') {
|
}>('https://api.leafone.cn/api/qqmusic?id=' + signedMid + '&type=8', 'GET');
|
||||||
|
//console.log(MusicReal);
|
||||||
|
return { ...MusicReal.data, mid: signedMid };
|
||||||
|
}
|
||||||
|
|
||||||
|
async CreateMusicThirdWay1(id: string = '', mid: string = '') {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//转换外域名为 https://qq.ugcimg.cn/v1/cpqcbu4b8870i61bde6k7cbmjgejq8mr3in82qir4qi7ielffv5slv8ck8g42novtmev26i233ujtuab6tvu2l2sjgtupfr389191v00s1j5oh5325j5eqi40774jv1i/khovifoh7jrqd6eahoiv7koh8o
|
//转换外域名为 https://qq.ugcimg.cn/v1/cpqcbu4b8870i61bde6k7cbmjgejq8mr3in82qir4qi7ielffv5slv8ck8g42novtmev26i233ujtuab6tvu2l2sjgtupfr389191v00s1j5oh5325j5eqi40774jv1i/khovifoh7jrqd6eahoiv7koh8o
|
||||||
//https://cgi.connect.qq.com/qqconnectopen/openapi/change_image_url?url=https://th.bing.com/th?id=OSK.b8ed36f1fb1889de6dc84fd81c187773&w=46&h=46&c=11&rs=1&qlt=80&o=6&dpr=2&pid=SANGAM
|
//https://cgi.connect.qq.com/qqconnectopen/openapi/change_image_url?url=https://th.bing.com/th?id=OSK.b8ed36f1fb1889de6dc84fd81c187773&w=46&h=46&c=11&rs=1&qlt=80&o=6&dpr=2&pid=SANGAM
|
||||||
|
|
||||||
@@ -283,9 +304,8 @@ export class NTQQMusicSignApi {
|
|||||||
|
|
||||||
//还有一处公告上传可以上传高质量图片 持久为qq域名
|
//还有一处公告上传可以上传高质量图片 持久为qq域名
|
||||||
async SignMusicWrapper(id: string = '') {
|
async SignMusicWrapper(id: string = '') {
|
||||||
const MusicInfo = await this.CreateMusicThridWay0(id)!;
|
const MusicInfo = await this.signWay03(id)!;
|
||||||
const MusicCard = await this.SignMusicInternal(MusicInfo.name!, MusicInfo.singer!, MusicInfo.cover!, MusicInfo.mid!, "https://ws.stream.qqmusic.qq.com/" + MusicInfo.url!);
|
return await this.signInternal(MusicInfo.name!, MusicInfo.singer!, MusicInfo.cover!, MusicInfo.mid!, 'https://ws.stream.qqmusic.qq.com/' + MusicInfo.url!);
|
||||||
return MusicCard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,36 +1,43 @@
|
|||||||
|
|
||||||
|
|
||||||
import { GeneralCallResult, InstanceContext, NapCatCore } from '@/core';
|
import { GeneralCallResult, InstanceContext, NapCatCore } from '@/core';
|
||||||
|
|
||||||
export class NTQQSystemApi {
|
export class NTQQSystemApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasOtherRunningQQProcess() {
|
async hasOtherRunningQQProcess() {
|
||||||
return this.context.wrapper.util.hasOtherRunningQQProcess();
|
return this.context.wrapper.util.hasOtherRunningQQProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
async ORCImage(filePath: string) {
|
async ORCImage(filePath: string) {
|
||||||
return this.context.session.getNodeMiscService().wantWinScreenOCR(filePath);
|
return this.context.session.getNodeMiscService().wantWinScreenOCR(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async translateEnWordToZn(words: string[]) {
|
async translateEnWordToZn(words: string[]) {
|
||||||
return this.context.session.getRichMediaService().translateEnWordToZn(words);
|
return this.context.session.getRichMediaService().translateEnWordToZn(words);
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用会超时 没灯用 (好像是通知listener的) onLineDev
|
//调用会超时 没灯用 (好像是通知listener的) onLineDev
|
||||||
async getOnlineDev() {
|
async getOnlineDev() {
|
||||||
return this.context.session.getMsgService().getOnLineDev();
|
return this.context.session.getMsgService().getOnLineDev();
|
||||||
}
|
}
|
||||||
|
|
||||||
//1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50
|
//1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50
|
||||||
async getArkJsonCollection(cid: string) {
|
async getArkJsonCollection(cid: string) {
|
||||||
const ret = await this.core.eventWrapper.callNoListenerEvent
|
const ret = await this.core.eventWrapper.callNoListenerEvent<(cid: string) => Promise<GeneralCallResult & {
|
||||||
<(cid: string) => Promise<GeneralCallResult & { arkJson: string }>>(
|
arkJson: string
|
||||||
|
}>>(
|
||||||
'NodeIKernelCollectionService/collectionArkShare',
|
'NodeIKernelCollectionService/collectionArkShare',
|
||||||
5000,
|
5000,
|
||||||
'1717662698058'
|
'1717662698058',
|
||||||
);
|
);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async BootMiniApp(appfile: string, params: string) {
|
async BootMiniApp(appfile: string, params: string) {
|
||||||
await this.context.session.getNodeMiscService().setMiniAppVersion('2.16.4');
|
await this.context.session.getNodeMiscService().setMiniAppVersion('2.16.4');
|
||||||
const c = await this.context.session.getNodeMiscService().getMiniAppPath();
|
const c = await this.context.session.getNodeMiscService().getMiniAppPath();
|
||||||
|
@@ -7,14 +7,16 @@ import { InstanceContext, NapCatCore } from '..';
|
|||||||
export class NTQQUserApi {
|
export class NTQQUserApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getProfileLike(uid: string) {
|
async getProfileLike(uid: string) {
|
||||||
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
||||||
friendUids: [
|
friendUids: [
|
||||||
uid
|
uid,
|
||||||
],
|
],
|
||||||
basic: 1,
|
basic: 1,
|
||||||
vote: 1,
|
vote: 1,
|
||||||
@@ -22,24 +24,32 @@ export class NTQQUserApi {
|
|||||||
userProfile: 1,
|
userProfile: 1,
|
||||||
type: 2,
|
type: 2,
|
||||||
start: 0,
|
start: 0,
|
||||||
limit: 20
|
limit: 20,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async setLongNick(longNick: string) {
|
async setLongNick(longNick: string) {
|
||||||
return this.context.session.getProfileService().setLongNick(longNick);
|
return this.context.session.getProfileService().setLongNick(longNick);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setSelfOnlineStatus(status: number, extStatus: number, batteryStatus: number) {
|
async setSelfOnlineStatus(status: number, extStatus: number, batteryStatus: number) {
|
||||||
return this.context.session.getMsgService().setStatus({ status: status, extStatus: extStatus, batteryStatus: batteryStatus });
|
return this.context.session.getMsgService().setStatus({
|
||||||
|
status: status,
|
||||||
|
extStatus: extStatus,
|
||||||
|
batteryStatus: batteryStatus,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBuddyRecommendContactArkJson(uin: string, sencenID = '') {
|
async getBuddyRecommendContactArkJson(uin: string, sencenID = '') {
|
||||||
return this.context.session.getBuddyService().getBuddyRecommendContactArkJson(uin, sencenID);
|
return this.context.session.getBuddyService().getBuddyRecommendContactArkJson(uin, sencenID);
|
||||||
}
|
}
|
||||||
|
|
||||||
async like(uid: string, count = 1): Promise<{ result: number, errMsg: string, succCounts: number }> {
|
async like(uid: string, count = 1): Promise<{ result: number, errMsg: string, succCounts: number }> {
|
||||||
return this.context.session.getProfileLikeService().setBuddyProfileLike({
|
return this.context.session.getProfileLikeService().setBuddyProfileLike({
|
||||||
friendUid: uid,
|
friendUid: uid,
|
||||||
sourceId: 71,
|
sourceId: 71,
|
||||||
doLikeCount: count,
|
doLikeCount: count,
|
||||||
doLikeTollCount: 0
|
doLikeTollCount: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +58,7 @@ export class NTQQUserApi {
|
|||||||
const ret = await this.context.session.getProfileService().setHeader(filePath) as setQQAvatarRet;
|
const ret = await this.context.session.getProfileService().setHeader(filePath) as setQQAvatarRet;
|
||||||
return { result: ret?.result, errMsg: ret?.errMsg };
|
return { result: ret?.result, errMsg: ret?.errMsg };
|
||||||
}
|
}
|
||||||
|
|
||||||
async setGroupAvatar(gc: string, filePath: string) {
|
async setGroupAvatar(gc: string, filePath: string) {
|
||||||
return this.context.session.getGroupService().setHeader(gc, filePath);
|
return this.context.session.getGroupService().setHeader(gc, filePath);
|
||||||
}
|
}
|
||||||
@@ -56,134 +67,130 @@ export class NTQQUserApi {
|
|||||||
//26702 以上使用新接口 .Dev Mlikiowa
|
//26702 以上使用新接口 .Dev Mlikiowa
|
||||||
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
||||||
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
||||||
let retData: User[] = [];
|
const retData: User[] = [];
|
||||||
let [_retData, _retListener] = await this.core.eventWrapper.CallNormalEvent
|
const [_retData, _retListener] = await this.core.eventWrapper.CallNormalEvent<
|
||||||
<EventService, EventListener>
|
EventService, EventListener
|
||||||
(
|
>(
|
||||||
'NodeIKernelProfileService/fetchUserDetailInfo',
|
'NodeIKernelProfileService/fetchUserDetailInfo',
|
||||||
'NodeIKernelProfileListener/onUserDetailInfoChanged',
|
'NodeIKernelProfileListener/onUserDetailInfoChanged',
|
||||||
uids.length,
|
uids.length,
|
||||||
5000,
|
5000,
|
||||||
(profile) => {
|
(profile) => {
|
||||||
if (uids.includes(profile.uid)) {
|
if (uids.includes(profile.uid)) {
|
||||||
let RetUser: User = {
|
const RetUser: User = {
|
||||||
...profile.simpleInfo.coreInfo,
|
...profile.simpleInfo.coreInfo,
|
||||||
...profile.simpleInfo.status,
|
...profile.simpleInfo.status,
|
||||||
...profile.simpleInfo.vasInfo,
|
...profile.simpleInfo.vasInfo,
|
||||||
...profile.commonExt,
|
...profile.commonExt,
|
||||||
...profile.simpleInfo.baseInfo,
|
...profile.simpleInfo.baseInfo,
|
||||||
qqLevel: profile.commonExt.qqLevel,
|
qqLevel: profile.commonExt.qqLevel,
|
||||||
pendantId: ""
|
pendantId: '',
|
||||||
};
|
};
|
||||||
retData.push(RetUser);
|
retData.push(RetUser);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
"BuddyProfileStore",
|
'BuddyProfileStore',
|
||||||
uids,
|
uids,
|
||||||
UserDetailSource.KSERVER,
|
UserDetailSource.KSERVER,
|
||||||
[
|
[ProfileBizType.KALL],
|
||||||
ProfileBizType.KALL
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return retData;
|
return retData;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchUserDetailInfo(uid: string) {
|
async fetchUserDetailInfo(uid: string) {
|
||||||
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
||||||
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
||||||
let [_retData, profile] = await this.core.eventWrapper.CallNormalEvent
|
const [_retData, profile] = await this.core.eventWrapper.CallNormalEvent<EventService, EventListener>(
|
||||||
<EventService, EventListener>
|
|
||||||
(
|
|
||||||
'NodeIKernelProfileService/fetchUserDetailInfo',
|
'NodeIKernelProfileService/fetchUserDetailInfo',
|
||||||
'NodeIKernelProfileListener/onUserDetailInfoChanged',
|
'NodeIKernelProfileListener/onUserDetailInfoChanged',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(profile) => {
|
(profile) => profile.uid === uid,
|
||||||
if (profile.uid === uid) {
|
'BuddyProfileStore',
|
||||||
return true;
|
[uid],
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
"BuddyProfileStore",
|
|
||||||
[
|
|
||||||
uid
|
|
||||||
],
|
|
||||||
UserDetailSource.KSERVER,
|
UserDetailSource.KSERVER,
|
||||||
[
|
[ProfileBizType.KALL],
|
||||||
ProfileBizType.KALL
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
let RetUser: User = {
|
const RetUser: User = {
|
||||||
...profile.simpleInfo.coreInfo,
|
...profile.simpleInfo.coreInfo,
|
||||||
...profile.simpleInfo.status,
|
...profile.simpleInfo.status,
|
||||||
...profile.simpleInfo.vasInfo,
|
...profile.simpleInfo.vasInfo,
|
||||||
...profile.commonExt,
|
...profile.commonExt,
|
||||||
...profile.simpleInfo.baseInfo,
|
...profile.simpleInfo.baseInfo,
|
||||||
qqLevel: profile.commonExt.qqLevel,
|
qqLevel: profile.commonExt.qqLevel,
|
||||||
pendantId: ""
|
pendantId: '',
|
||||||
};
|
};
|
||||||
return RetUser;
|
return RetUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserDetailInfo(uid: string) {
|
async getUserDetailInfo(uid: string) {
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
||||||
return this.fetchUserDetailInfo(uid);
|
return this.fetchUserDetailInfo(uid);
|
||||||
}
|
}
|
||||||
return this.getUserDetailInfoOld(uid);
|
return this.getUserDetailInfoOld(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserDetailInfoOld(uid: string) {
|
async getUserDetailInfoOld(uid: string) {
|
||||||
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo'];
|
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo'];
|
||||||
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged'];
|
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged'];
|
||||||
let [_retData, profile] = await this.core.eventWrapper.CallNormalEvent
|
const [_retData, profile] = await this.core.eventWrapper.CallNormalEvent<EventService, EventListener>(
|
||||||
<EventService, EventListener>
|
|
||||||
(
|
|
||||||
'NodeIKernelProfileService/getUserDetailInfoWithBizInfo',
|
'NodeIKernelProfileService/getUserDetailInfoWithBizInfo',
|
||||||
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
|
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
|
||||||
2,
|
2,
|
||||||
5000,
|
5000,
|
||||||
(profile: User) => {
|
(profile) => profile.uid === uid,
|
||||||
if (profile.uid === uid) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
uid,
|
uid,
|
||||||
[0]
|
[0],
|
||||||
);
|
);
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
async modifySelfProfile(param: ModifyProfileParams) {
|
async modifySelfProfile(param: ModifyProfileParams) {
|
||||||
return this.context.session.getProfileService().modifyDesktopMiniProfile(param);
|
return this.context.session.getProfileService().modifyDesktopMiniProfile(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
async getCookies(domain: string) {
|
async getCookies(domain: string) {
|
||||||
const ClientKeyData = await this.forceFetchClientKey();
|
const ClientKeyData = await this.forceFetchClientKey();
|
||||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2F' + domain + '%2F' + this.core.selfInfo.uin + '%2Finfocenter&keyindex=19%27'
|
const requestUrl = `https://ssl.ptlogin2.qq.com/jump?${
|
||||||
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
new URLSearchParams({
|
||||||
return cookies;
|
ptlang: '1033',
|
||||||
|
clientuin: this.core.selfInfo.uin,
|
||||||
|
clientkey: ClientKeyData.clientKey,
|
||||||
|
u1: `https://user.qzone.qq.com/${this.core.selfInfo.uin}/infocenter`,
|
||||||
|
keyindex: '19',
|
||||||
|
})
|
||||||
|
}`;
|
||||||
|
return await RequestUtil.HttpsGetCookies(requestUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPSkey(domainList: string[]) {
|
async getPSkey(domainList: string[]) {
|
||||||
return await this.context.session.getTipOffService().getPskey(domainList, true);
|
return await this.context.session.getTipOffService().getPskey(domainList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRobotUinRange(): Promise<Array<any>> {
|
async getRobotUinRange(): Promise<Array<any>> {
|
||||||
const robotUinRanges = await this.context.session.getRobotService().getRobotUinRange({
|
const robotUinRanges = await this.context.session.getRobotService().getRobotUinRange({
|
||||||
justFetchMsgConfig: '1',
|
justFetchMsgConfig: '1',
|
||||||
type: 1,
|
type: 1,
|
||||||
version: 0,
|
version: 0,
|
||||||
aioKeywordVersion: 0
|
aioKeywordVersion: 0,
|
||||||
});
|
});
|
||||||
// console.log(robotUinRanges?.response?.robotUinRanges);
|
// console.log(robotUinRanges?.response?.robotUinRanges);
|
||||||
return robotUinRanges?.response?.robotUinRanges;
|
return robotUinRanges?.response?.robotUinRanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
|
|
||||||
async getQzoneCookies() {
|
async getQzoneCookies() {
|
||||||
const ClientKeyData = await this.forceFetchClientKey();
|
const ClientKeyData = await this.forceFetchClientKey();
|
||||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2Fuser.qzone.qq.com%2F' + this.core.selfInfo.uin + '%2Finfocenter&keyindex=19%27'
|
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2Fuser.qzone.qq.com%2F' + this.core.selfInfo.uin + '%2Finfocenter&keyindex=19%27';
|
||||||
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
const cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
|
|
||||||
async getSkey(): Promise<string | undefined> {
|
async getSkey(): Promise<string | undefined> {
|
||||||
@@ -194,22 +201,28 @@ export class NTQQUserApi {
|
|||||||
const clientKey = ClientKeyData.clientKey;
|
const clientKey = ClientKeyData.clientKey;
|
||||||
const keyIndex = ClientKeyData.keyIndex;
|
const keyIndex = ClientKeyData.keyIndex;
|
||||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin + '&clientkey=' + clientKey + '&u1=https%3A%2F%2Fh5.qzone.qq.com%2Fqqnt%2Fqzoneinpcqq%2Ffriend%3Frefresh%3D0%26clientuin%3D0%26darkMode%3D0&keyindex=19%27';
|
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin + '&clientkey=' + clientKey + '&u1=https%3A%2F%2Fh5.qzone.qq.com%2Fqqnt%2Fqzoneinpcqq%2Ffriend%3Frefresh%3D0%26clientuin%3D0%26darkMode%3D0&keyindex=19%27';
|
||||||
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
const cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||||
const skey = cookies['skey'];
|
const skey = cookies['skey'];
|
||||||
if (!skey) {
|
if (!skey) {
|
||||||
throw new Error('getSkey Skey is Empty');
|
throw new Error('getSkey Skey is Empty');
|
||||||
}
|
}
|
||||||
return skey;
|
return skey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
async getUidByUin(Uin: string) {
|
async getUidByUin(Uin: string) {
|
||||||
//此代码仅临时使用,后期会被废弃
|
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
||||||
return await this.getUidByUinV2(Uin);
|
return await this.getUidByUinV2(Uin);
|
||||||
}
|
}
|
||||||
return await this.getUidByUinV1(Uin);
|
return await this.getUidByUinV1(Uin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
async getUinByUid(Uid: string) {
|
async getUinByUid(Uid: string) {
|
||||||
//此代码仅临时使用,后期会被废弃
|
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
||||||
return await this.getUinByUidV2(Uid);
|
return await this.getUinByUidV2(Uid);
|
||||||
}
|
}
|
||||||
@@ -229,11 +242,12 @@ export class NTQQUserApi {
|
|||||||
if (uid) return uid;
|
if (uid) return uid;
|
||||||
uid = (await this.core.getApiContext().FriendApi.getBuddyIdMap(true)).getValue(Uin);
|
uid = (await this.core.getApiContext().FriendApi.getBuddyIdMap(true)).getValue(Uin);
|
||||||
if (uid) return uid;
|
if (uid) return uid;
|
||||||
let 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;
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//后期改成流水线处理
|
//后期改成流水线处理
|
||||||
async getUinByUidV2(Uid: string) {
|
async getUinByUidV2(Uid: string) {
|
||||||
let uin = (await this.context.session.getProfileService().getUinByUid('FriendsServiceImpl', [Uid])).get(Uid);
|
let uin = (await this.context.session.getProfileService().getUinByUid('FriendsServiceImpl', [Uid])).get(Uid);
|
||||||
@@ -254,20 +268,17 @@ export class NTQQUserApi {
|
|||||||
// 通用转换开始尝试
|
// 通用转换开始尝试
|
||||||
let uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
let uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
let unveifyUid = (await this.getUserDetailInfoByUin(Uin)).info.uid;//从QQ Native 特殊转换 方法三
|
const unveifyUid = (await this.getUserDetailInfoByUin(Uin)).info.uid;//从QQ Native 特殊转换 方法三
|
||||||
if (unveifyUid.indexOf("*") == -1) {
|
if (unveifyUid.indexOf('*') == -1) {
|
||||||
uid = unveifyUid;
|
uid = unveifyUid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUinByUidV1(Uid: string) {
|
async getUinByUidV1(Uid: string) {
|
||||||
let ret = await this.core.eventWrapper.callNoListenerEvent
|
const ret = await this.core.eventWrapper.callNoListenerEvent<(Uin: string[]) => Promise<{ uinInfo: Map<string, string> }>>
|
||||||
<(Uin: string[]) => Promise<{ uinInfo: Map<string, string> }>>(
|
('NodeIKernelUixConvertService/getUin', 5000, [Uid]);
|
||||||
'NodeIKernelUixConvertService/getUin',
|
|
||||||
5000,
|
|
||||||
[Uid]
|
|
||||||
);
|
|
||||||
let uin = ret.uinInfo.get(Uid);
|
let uin = ret.uinInfo.get(Uid);
|
||||||
if (!uin) {
|
if (!uin) {
|
||||||
uin = (await this.getUserDetailInfo(Uid)).uin; //从QQ Native 转换
|
uin = (await this.getUserDetailInfo(Uid)).uin; //从QQ Native 转换
|
||||||
@@ -280,33 +291,31 @@ export class NTQQUserApi {
|
|||||||
// }
|
// }
|
||||||
return uin;
|
return uin;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecentContactListSnapShot(count: number) {
|
async getRecentContactListSnapShot(count: number) {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactListSnapShot(count);
|
return await this.context.session.getRecentContactService().getRecentContactListSnapShot(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecentContactListSyncLimit(count: number) {
|
async getRecentContactListSyncLimit(count: number) {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactListSyncLimit(count);
|
return await this.context.session.getRecentContactService().getRecentContactListSyncLimit(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecentContactListSync() {
|
async getRecentContactListSync() {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactListSync();
|
return await this.context.session.getRecentContactService().getRecentContactListSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecentContactList() {
|
async getRecentContactList() {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactList();
|
return await this.context.session.getRecentContactService().getRecentContactList();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserDetailInfoByUinV2(Uin: string) {
|
async getUserDetailInfoByUinV2(Uin: string) {
|
||||||
return await this.core.eventWrapper.callNoListenerEvent
|
return await this.core.eventWrapper.callNoListenerEvent<(Uin: string) => Promise<UserDetailInfoByUinV2>>
|
||||||
<(Uin: string) => Promise<UserDetailInfoByUinV2>>(
|
('NodeIKernelProfileService/getUserDetailInfoByUin', 5000, Uin);
|
||||||
'NodeIKernelProfileService/getUserDetailInfoByUin',
|
|
||||||
5000,
|
|
||||||
Uin
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserDetailInfoByUin(Uin: string) {
|
async getUserDetailInfoByUin(Uin: string) {
|
||||||
return this.core.eventWrapper.callNoListenerEvent
|
return this.core.eventWrapper.callNoListenerEvent<(Uin: string) => Promise<UserDetailInfoByUin>>
|
||||||
<(Uin: string) => Promise<UserDetailInfoByUin>>(
|
('NodeIKernelProfileService/getUserDetailInfoByUin', 5000, Uin);
|
||||||
'NodeIKernelProfileService/getUserDetailInfoByUin',
|
|
||||||
5000,
|
|
||||||
Uin
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
async forceFetchClientKey() {
|
async forceFetchClientKey() {
|
||||||
return await this.context.session.getTicketService().forceFetchClientKey('');
|
return await this.context.session.getTicketService().forceFetchClientKey('');
|
||||||
|
Reference in New Issue
Block a user