mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
chore: fix indentation and semi in core
This commit is contained in:
@@ -4,7 +4,7 @@ module.exports = {
|
|||||||
'es2021': true,
|
'es2021': true,
|
||||||
'node': true
|
'node': true
|
||||||
},
|
},
|
||||||
'ignorePatterns': ['src/core/', 'src/core.lib/','src/proto/'],
|
'ignorePatterns': ['src/proto/'],
|
||||||
'extends': [
|
'extends': [
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:@typescript-eslint/recommended'
|
'plugin:@typescript-eslint/recommended'
|
||||||
|
@@ -8,7 +8,7 @@ export class NTQQCollectionApi {
|
|||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
async createCollection(authorUin: string, authorUid: string, authorName: string, brief: string, rawData: string) {
|
async createCollection(authorUin: string, authorUid: string, authorName: string, brief: string, rawData: string) {
|
||||||
let param = {
|
const param = {
|
||||||
commInfo: {
|
commInfo: {
|
||||||
bid: 1,
|
bid: 1,
|
||||||
category: 2,
|
category: 2,
|
||||||
@@ -45,7 +45,7 @@ export class NTQQCollectionApi {
|
|||||||
return this.context.session.getCollectionService().createNewCollectionItem(param);
|
return this.context.session.getCollectionService().createNewCollectionItem(param);
|
||||||
}
|
}
|
||||||
async getAllCollection(category: number = 0, count: number = 50) {
|
async getAllCollection(category: number = 0, count: number = 50) {
|
||||||
let param = {
|
const param = {
|
||||||
category: category,
|
category: category,
|
||||||
groupId: -1,
|
groupId: -1,
|
||||||
forceSync: true,
|
forceSync: true,
|
||||||
|
@@ -88,7 +88,7 @@ export class NTQQFileApi {
|
|||||||
return sourcePath;
|
return sourcePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let data = await this.core.eventWrapper.CallNormalEvent<
|
const data = await this.core.eventWrapper.CallNormalEvent<
|
||||||
(
|
(
|
||||||
params: {
|
params: {
|
||||||
fileModelId: string,
|
fileModelId: string,
|
||||||
@@ -246,17 +246,17 @@ export class NTQQFileApi {
|
|||||||
end: number
|
end: number
|
||||||
}[]
|
}[]
|
||||||
}[]
|
}[]
|
||||||
};
|
}
|
||||||
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>('NodeIKernelSearchListener/onSearchFileKeywordsResult', 1, 20000, (params) => {
|
||||||
if (id !== '' && params.searchId == id) {
|
if (id !== '' && params.searchId == id) {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
id = await Event!(keys, 12);
|
id = await Event!(keys, 12);
|
||||||
let [ret] = (await Listener);
|
const [ret] = (await Listener);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
async getImageUrl(element: PicElement) {
|
async getImageUrl(element: PicElement) {
|
||||||
@@ -269,9 +269,9 @@ export class NTQQFileApi {
|
|||||||
const fileUuid = element.fileUuid;
|
const fileUuid = element.fileUuid;
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
let UrlParse = new URL(IMAGE_HTTP_HOST + url);//临时解析拼接
|
const UrlParse = new URL(IMAGE_HTTP_HOST + url);//临时解析拼接
|
||||||
let imageAppid = UrlParse.searchParams.get('appid');
|
const imageAppid = UrlParse.searchParams.get('appid');
|
||||||
let isNewPic = imageAppid && ['1406', '1407'].includes(imageAppid);
|
const isNewPic = imageAppid && ['1406', '1407'].includes(imageAppid);
|
||||||
if (isNewPic) {
|
if (isNewPic) {
|
||||||
let UrlRkey = UrlParse.searchParams.get('rkey');
|
let UrlRkey = UrlParse.searchParams.get('rkey');
|
||||||
if (UrlRkey) {
|
if (UrlRkey) {
|
||||||
|
@@ -9,7 +9,7 @@ export class NTQQFriendApi {
|
|||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
async getBuddyV2(refresh = false): Promise<FriendV2[]> {
|
async getBuddyV2(refresh = false): Promise<FriendV2[]> {
|
||||||
let 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));
|
||||||
@@ -22,8 +22,8 @@ export class NTQQFriendApi {
|
|||||||
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>> {
|
||||||
let uids: string[] = [];
|
const uids: string[] = [];
|
||||||
let retMap: LimitedHashTable<string, string> = new LimitedHashTable<string, string>(5000);
|
const retMap: LimitedHashTable<string, string> = new LimitedHashTable<string, string>(5000);
|
||||||
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));
|
||||||
@@ -37,8 +37,8 @@ export class NTQQFriendApi {
|
|||||||
return retMap;
|
return retMap;
|
||||||
}
|
}
|
||||||
async getBuddyV2ExWithCate(refresh = false) {
|
async getBuddyV2ExWithCate(refresh = false) {
|
||||||
let uids: string[] = [];
|
const uids: string[] = [];
|
||||||
let categoryMap: Map<string, any> = new Map();
|
const categoryMap: Map<string, any> = new Map();
|
||||||
const buddyService = this.context.session.getBuddyService();
|
const buddyService = this.context.session.getBuddyService();
|
||||||
const buddyListV2 = refresh ? (await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL)).data : (await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL)).data;
|
const buddyListV2 = refresh ? (await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL)).data : (await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL)).data;
|
||||||
uids.push(
|
uids.push(
|
||||||
@@ -46,7 +46,7 @@ export class NTQQFriendApi {
|
|||||||
item.buddyUids.forEach(uid => {
|
item.buddyUids.forEach(uid => {
|
||||||
categoryMap.set(uid, { categoryId: item.categoryId, categroyName: item.categroyName });
|
categoryMap.set(uid, { categoryId: item.categoryId, categroyName: item.categroyName });
|
||||||
});
|
});
|
||||||
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
|
||||||
@@ -65,7 +65,7 @@ export class NTQQFriendApi {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getFriends(forced = false): Promise<User[]> {
|
async getFriends(forced = false): Promise<User[]> {
|
||||||
let [_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',
|
||||||
@@ -85,12 +85,12 @@ export class NTQQFriendApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async handleFriendRequest(flag: string, accept: boolean) {
|
async handleFriendRequest(flag: string, accept: boolean) {
|
||||||
let data = flag.split('|');
|
const data = flag.split('|');
|
||||||
if (data.length < 2) {
|
if (data.length < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let friendUid = data[0];
|
const friendUid = data[0];
|
||||||
let reqTime = data[1];
|
const reqTime = data[1];
|
||||||
this.context.session.getBuddyService()?.approvalFriendRequest({
|
this.context.session.getBuddyService()?.approvalFriendRequest({
|
||||||
friendUid: friendUid,
|
friendUid: friendUid,
|
||||||
reqTime: reqTime,
|
reqTime: reqTime,
|
||||||
|
@@ -14,7 +14,7 @@ export class NTQQGroupApi {
|
|||||||
}
|
}
|
||||||
async getGroups(forced = false) {
|
async getGroups(forced = false) {
|
||||||
type ListenerType = NodeIKernelGroupListener['onGroupListUpdate'];
|
type ListenerType = NodeIKernelGroupListener['onGroupListUpdate'];
|
||||||
let [_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',
|
||||||
@@ -41,26 +41,26 @@ export class NTQQGroupApi {
|
|||||||
*/
|
*/
|
||||||
async getGroupMemberLastestSendTime(GroupCode: string) {
|
async getGroupMemberLastestSendTime(GroupCode: string) {
|
||||||
const getdata = async (uid: string) => {
|
const getdata = async (uid: string) => {
|
||||||
let NTRet = await this.getLastestMsgByUids(GroupCode, [uid]);
|
const NTRet = await this.getLastestMsgByUids(GroupCode, [uid]);
|
||||||
if (NTRet.result != 0 && NTRet.msgList.length < 1) {
|
if (NTRet.result != 0 && NTRet.msgList.length < 1) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return { sendUin: NTRet.msgList[0].senderUin, sendTime: NTRet.msgList[0].msgTime }
|
return { sendUin: NTRet.msgList[0].senderUin, sendTime: NTRet.msgList[0].msgTime };
|
||||||
}
|
};
|
||||||
let currentGroupMembers = groupMembers.get(GroupCode);
|
const currentGroupMembers = groupMembers.get(GroupCode);
|
||||||
let PromiseData: Promise<({
|
const PromiseData: Promise<({
|
||||||
sendUin: string;
|
sendUin: string;
|
||||||
sendTime: string;
|
sendTime: string;
|
||||||
} | undefined)>[] = [];
|
} | undefined)>[] = [];
|
||||||
let ret: Map<string, string> = new Map();
|
const ret: Map<string, string> = new Map();
|
||||||
if (!currentGroupMembers) {
|
if (!currentGroupMembers) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (let member of currentGroupMembers.values()) {
|
for (const member of currentGroupMembers.values()) {
|
||||||
PromiseData.push(getdata(member.uid).catch(() => undefined));
|
PromiseData.push(getdata(member.uid).catch(() => undefined));
|
||||||
}
|
}
|
||||||
let allRet = await runAllWithTimeout(PromiseData, 2500);
|
const allRet = await runAllWithTimeout(PromiseData, 2500);
|
||||||
for (let PromiseDo of allRet) {
|
for (const PromiseDo of allRet) {
|
||||||
if (PromiseDo) {
|
if (PromiseDo) {
|
||||||
ret.set(PromiseDo.sendUin, PromiseDo.sendTime);
|
ret.set(PromiseDo.sendUin, PromiseDo.sendTime);
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ export class NTQQGroupApi {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
async getLastestMsgByUids(GroupCode: string, uids: string[]) {
|
async getLastestMsgByUids(GroupCode: string, uids: string[]) {
|
||||||
let ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
||||||
chatInfo: {
|
chatInfo: {
|
||||||
peerUid: GroupCode,
|
peerUid: GroupCode,
|
||||||
chatType: ChatType.group,
|
chatType: ChatType.group,
|
||||||
@@ -87,14 +87,14 @@ export class NTQQGroupApi {
|
|||||||
return this.context.session.getGroupService().getAllMemberList(GroupCode, forced);
|
return this.context.session.getGroupService().getAllMemberList(GroupCode, forced);
|
||||||
}
|
}
|
||||||
async getLastestMsg(GroupCode: string, uins: string[]) {
|
async getLastestMsg(GroupCode: string, uins: string[]) {
|
||||||
let uids: Array<string> = [];
|
const uids: Array<string> = [];
|
||||||
for (let uin of uins) {
|
for (const uin of uins) {
|
||||||
let uid = await this.core.getApiContext().UserApi.getUidByUin(uin)
|
const uid = await this.core.getApiContext().UserApi.getUidByUin(uin);
|
||||||
if (uid) {
|
if (uid) {
|
||||||
uids.push(uid);
|
uids.push(uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
||||||
chatInfo: {
|
chatInfo: {
|
||||||
peerUid: GroupCode,
|
peerUid: GroupCode,
|
||||||
chatType: ChatType.group,
|
chatType: ChatType.group,
|
||||||
@@ -124,8 +124,8 @@ export class NTQQGroupApi {
|
|||||||
async addGroupEssence(GroupCode: string, msgId: string) {
|
async addGroupEssence(GroupCode: string, msgId: string) {
|
||||||
// 代码没测过
|
// 代码没测过
|
||||||
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
||||||
let 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);
|
||||||
let 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)
|
||||||
@@ -136,8 +136,8 @@ export class NTQQGroupApi {
|
|||||||
async removeGroupEssence(GroupCode: string, msgId: string) {
|
async removeGroupEssence(GroupCode: string, msgId: string) {
|
||||||
// 代码没测过
|
// 代码没测过
|
||||||
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
||||||
let 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);
|
||||||
let 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)
|
||||||
@@ -146,7 +146,7 @@ export class NTQQGroupApi {
|
|||||||
return this.context.session.getGroupService().removeGroupEssence(param);
|
return this.context.session.getGroupService().removeGroupEssence(param);
|
||||||
}
|
}
|
||||||
async getSingleScreenNotifies(num: number) {
|
async getSingleScreenNotifies(num: number) {
|
||||||
let [_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',
|
||||||
@@ -209,7 +209,7 @@ export class NTQQGroupApi {
|
|||||||
async getGroupIgnoreNotifies() {
|
async getGroupIgnoreNotifies() {
|
||||||
}
|
}
|
||||||
async getArkJsonGroupShare(GroupCode: string) {
|
async getArkJsonGroupShare(GroupCode: string) {
|
||||||
let ret = await this.core.eventWrapper.callNoListenerEvent
|
const ret = await this.core.eventWrapper.callNoListenerEvent
|
||||||
<(GroupId: string) => Promise<GeneralCallResult & { arkJson: string }>>(
|
<(GroupId: string) => Promise<GeneralCallResult & { arkJson: string }>>(
|
||||||
'NodeIKernelGroupService/getGroupRecommendContactArkJson',
|
'NodeIKernelGroupService/getGroupRecommendContactArkJson',
|
||||||
5000,
|
5000,
|
||||||
@@ -223,10 +223,10 @@ export class NTQQGroupApi {
|
|||||||
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) {
|
||||||
let flagitem = flag.split('|');
|
const flagitem = flag.split('|');
|
||||||
let groupCode = flagitem[0];
|
const groupCode = flagitem[0];
|
||||||
let seq = flagitem[1];
|
const seq = flagitem[1];
|
||||||
let type = parseInt(flagitem[2]);
|
const type = parseInt(flagitem[2]);
|
||||||
|
|
||||||
return this.context.session.getGroupService().operateSysNotify(
|
return this.context.session.getGroupService().operateSysNotify(
|
||||||
false,
|
false,
|
||||||
@@ -278,7 +278,7 @@ 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编码
|
||||||
let data = {
|
const data = {
|
||||||
text: encodeURI(content),
|
text: encodeURI(content),
|
||||||
picInfo: picInfo,
|
picInfo: picInfo,
|
||||||
oldFeedsId: '',
|
oldFeedsId: '',
|
||||||
|
@@ -16,7 +16,7 @@ export class NTQQMsgApi {
|
|||||||
async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) {
|
async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) {
|
||||||
//console.log(peer, msgSeq, emojiId, emojiType, count);
|
//console.log(peer, msgSeq, emojiId, emojiType, count);
|
||||||
//注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged M likiowa
|
//注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged M likiowa
|
||||||
return this.context.session.getMsgService().getMsgEmojiLikesList(peer, msgSeq, emojiId, emojiType, "", false, 20)
|
return this.context.session.getMsgService().getMsgEmojiLikesList(peer, msgSeq, emojiId, emojiType, "", false, 20);
|
||||||
}
|
}
|
||||||
// napCatCore: NapCatCore | null = null;
|
// napCatCore: NapCatCore | null = null;
|
||||||
// enum BaseEmojiType {
|
// enum BaseEmojiType {
|
||||||
@@ -42,7 +42,7 @@ export class NTQQMsgApi {
|
|||||||
return this.context.session.getMsgService().forwardMsg(msgIds, peer, [peer], new Map());
|
return this.context.session.getMsgService().forwardMsg(msgIds, peer, [peer], new Map());
|
||||||
}
|
}
|
||||||
async getLastestMsgByUids(peer: Peer, count: number = 20, isReverseOrder: boolean = false) {
|
async getLastestMsgByUids(peer: Peer, count: number = 20, isReverseOrder: boolean = false) {
|
||||||
let ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
|
||||||
chatInfo: peer,
|
chatInfo: peer,
|
||||||
filterMsgType: [],
|
filterMsgType: [],
|
||||||
filterSendersUid: [],
|
filterSendersUid: [],
|
||||||
@@ -64,10 +64,10 @@ export class NTQQMsgApi {
|
|||||||
return await this.context.session.getMsgService().getSingleMsg(peer, seq);
|
return await this.context.session.getMsgService().getSingleMsg(peer, seq);
|
||||||
}
|
}
|
||||||
async fetchFavEmojiList(num: number) {
|
async fetchFavEmojiList(num: number) {
|
||||||
return this.context.session.getMsgService().fetchFavEmojiList("", num, true, true)
|
return this.context.session.getMsgService().fetchFavEmojiList("", num, true, true);
|
||||||
}
|
}
|
||||||
async queryMsgsWithFilterExWithSeq(peer: Peer, msgSeq: string) {
|
async queryMsgsWithFilterExWithSeq(peer: Peer, msgSeq: string) {
|
||||||
let ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', msgSeq, {
|
const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', msgSeq, {
|
||||||
chatInfo: peer,//此处为Peer 为关键查询参数 没有啥也没有 by mlik iowa
|
chatInfo: peer,//此处为Peer 为关键查询参数 没有啥也没有 by mlik iowa
|
||||||
filterMsgType: [],
|
filterMsgType: [],
|
||||||
filterSendersUid: [],
|
filterSendersUid: [],
|
||||||
@@ -86,7 +86,7 @@ export class NTQQMsgApi {
|
|||||||
return this.context.session.getMsgService().setMsgRead(peer);
|
return this.context.session.getMsgService().setMsgRead(peer);
|
||||||
}
|
}
|
||||||
async getGroupFileList(GroupCode: string, params: GetFileListParam) {
|
async getGroupFileList(GroupCode: string, params: GetFileListParam) {
|
||||||
let 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
|
||||||
>(
|
>(
|
||||||
@@ -134,7 +134,7 @@ export class NTQQMsgApi {
|
|||||||
//兜底识别策略V2
|
//兜底识别策略V2
|
||||||
msgId = generateMsgId().toString();
|
msgId = generateMsgId().toString();
|
||||||
}
|
}
|
||||||
let 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
|
||||||
>(
|
>(
|
||||||
@@ -143,7 +143,7 @@ export class NTQQMsgApi {
|
|||||||
1,
|
1,
|
||||||
timeout,
|
timeout,
|
||||||
(msgRecords: RawMessage[]) => {
|
(msgRecords: RawMessage[]) => {
|
||||||
for (let msgRecord of msgRecords) {
|
for (const msgRecord of msgRecords) {
|
||||||
if (msgRecord.msgId === msgId && msgRecord.sendStatus === 2) {
|
if (msgRecord.msgId === msgId && msgRecord.sendStatus === 2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ export class NTQQMsgApi {
|
|||||||
msgElements,
|
msgElements,
|
||||||
new Map()
|
new Map()
|
||||||
);
|
);
|
||||||
let retMsg = data[1].find(msgRecord => {
|
const retMsg = data[1].find(msgRecord => {
|
||||||
if (msgRecord.msgId === msgId) {
|
if (msgRecord.msgId === msgId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -167,9 +167,9 @@ export class NTQQMsgApi {
|
|||||||
}
|
}
|
||||||
async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
||||||
//唉? !我有个想法
|
//唉? !我有个想法
|
||||||
let msgId = await this.getMsgUnique(peer.chatType, await this.getServerTime());
|
const msgId = await this.getMsgUnique(peer.chatType, await this.getServerTime());
|
||||||
peer.guildId = msgId;
|
peer.guildId = msgId;
|
||||||
let 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
|
||||||
>(
|
>(
|
||||||
@@ -178,7 +178,7 @@ export class NTQQMsgApi {
|
|||||||
1,
|
1,
|
||||||
timeout,
|
timeout,
|
||||||
(msgRecords: RawMessage[]) => {
|
(msgRecords: RawMessage[]) => {
|
||||||
for (let 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;
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ export class NTQQMsgApi {
|
|||||||
msgElements,
|
msgElements,
|
||||||
new Map()
|
new Map()
|
||||||
);
|
);
|
||||||
let retMsg = data[1].find(msgRecord => {
|
const retMsg = data[1].find(msgRecord => {
|
||||||
if (msgRecord.guildId === msgId) {
|
if (msgRecord.guildId === msgId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ export class NTQQMsgApi {
|
|||||||
const msgInfos = msgIds.map(id => {
|
const msgInfos = msgIds.map(id => {
|
||||||
return { msgId: id, senderShowName: this.core.selfInfo.nick };
|
return { msgId: id, senderShowName: this.core.selfInfo.nick };
|
||||||
});
|
});
|
||||||
let 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
|
||||||
>(
|
>(
|
||||||
@@ -225,7 +225,7 @@ export class NTQQMsgApi {
|
|||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(msgRecords: RawMessage[]) => {
|
(msgRecords: RawMessage[]) => {
|
||||||
for (let 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;
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ export class NTQQMsgApi {
|
|||||||
[],
|
[],
|
||||||
new Map()
|
new Map()
|
||||||
);
|
);
|
||||||
for (let 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) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -4,7 +4,7 @@ import { selfInfo } from '../data';
|
|||||||
import { RequestUtil } from '@/common/utils/request';
|
import { RequestUtil } from '@/common/utils/request';
|
||||||
import { WebApi } from './webapi';
|
import { WebApi } from './webapi';
|
||||||
import { checkFileReceived, checkFileReceived2, uri2local } from '@/common/utils/file';
|
import { checkFileReceived, checkFileReceived2, uri2local } from '@/common/utils/file';
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs';
|
||||||
import { sleep } from '@/common/utils/helper';
|
import { sleep } from '@/common/utils/helper';
|
||||||
export interface IdMusicSignPostData {
|
export interface IdMusicSignPostData {
|
||||||
type: 'qq' | '163',
|
type: 'qq' | '163',
|
||||||
@@ -146,7 +146,7 @@ export async function SignMiniApp(CardData: MiniAppLuaJsonType) {
|
|||||||
// }
|
// }
|
||||||
// return hash & 0x7fffffff;
|
// return hash & 0x7fffffff;
|
||||||
// }
|
// }
|
||||||
let signCard = {
|
const signCard = {
|
||||||
"app": "com.tencent.miniapp.lua",
|
"app": "com.tencent.miniapp.lua",
|
||||||
"bizsrc": "tianxuan.imgJumpArk",
|
"bizsrc": "tianxuan.imgJumpArk",
|
||||||
"view": "miniapp",
|
"view": "miniapp",
|
||||||
@@ -202,15 +202,15 @@ export async function SignMiniApp(CardData: MiniAppLuaJsonType) {
|
|||||||
// "view": "eventshare",
|
// "view": "eventshare",
|
||||||
// "ver": "0.0.0.1"
|
// "ver": "0.0.0.1"
|
||||||
// };
|
// };
|
||||||
let data = (await NTQQUserApi.getQzoneCookies());
|
const data = (await NTQQUserApi.getQzoneCookies());
|
||||||
const Bkn = WebApi.genBkn(data.p_skey);
|
const Bkn = WebApi.genBkn(data.p_skey);
|
||||||
|
|
||||||
const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + selfInfo.uin + '; uin=o' + selfInfo.uin;
|
const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + selfInfo.uin + '; uin=o' + selfInfo.uin;
|
||||||
|
|
||||||
let 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 {
|
||||||
let 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) {
|
||||||
@@ -220,9 +220,9 @@ export async function SignMiniApp(CardData: MiniAppLuaJsonType) {
|
|||||||
}
|
}
|
||||||
export async function SignMusicInternal(songname: string, singer: string, cover: string, songmid: string, songmusic: string) {
|
export async function SignMusicInternal(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"}'
|
||||||
let 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";
|
||||||
let signCard = {
|
const signCard = {
|
||||||
app: "com.tencent.qqreader.share",
|
app: "com.tencent.qqreader.share",
|
||||||
config: {
|
config: {
|
||||||
ctime: 1718634110,
|
ctime: 1718634110,
|
||||||
@@ -260,16 +260,16 @@ export async function SignMusicInternal(songname: string, singer: string, cover:
|
|||||||
prompt: "[分享]" + songname,
|
prompt: "[分享]" + songname,
|
||||||
ver: "0.0.0.1",
|
ver: "0.0.0.1",
|
||||||
view: "music"
|
view: "music"
|
||||||
}
|
};
|
||||||
//console.log(JSON.stringify(signCard, null, 2));
|
//console.log(JSON.stringify(signCard, null, 2));
|
||||||
let 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;
|
||||||
}
|
}
|
||||||
//注意处理错误
|
//注意处理错误
|
||||||
export async function CreateMusicThridWay0(id: string = '', mid: string = '') {
|
export async function CreateMusicThridWay0(id: string = '', mid: string = '') {
|
||||||
if (mid == '') {
|
if (mid == '') {
|
||||||
let 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"}}',
|
||||||
@@ -279,7 +279,7 @@ export async function CreateMusicThridWay0(id: string = '', mid: string = '') {
|
|||||||
mid = MusicInfo.songinfo?.data?.track_info.mid!;
|
mid = MusicInfo.songinfo?.data?.track_info.mid!;
|
||||||
}
|
}
|
||||||
//第三方接口 存在速率限制 现在勉强用
|
//第三方接口 存在速率限制 现在勉强用
|
||||||
let MusicReal = await RequestUtil.HttpGetJson
|
const MusicReal = await RequestUtil.HttpGetJson
|
||||||
<{ code: number, data?: { name: string, singer: string, url: string, cover: string } }>
|
<{ code: number, data?: { name: string, singer: string, url: string, cover: string } }>
|
||||||
('https://api.leafone.cn/api/qqmusic?id=' + mid + '&type=8', 'GET', undefined);
|
('https://api.leafone.cn/api/qqmusic?id=' + mid + '&type=8', 'GET', undefined);
|
||||||
//console.log(MusicReal);
|
//console.log(MusicReal);
|
||||||
@@ -302,7 +302,7 @@ export async function CreateMusicThridWay1(id: string = '', mid: string = '') {
|
|||||||
|
|
||||||
//还有一处公告上传可以上传高质量图片 持久为qq域名
|
//还有一处公告上传可以上传高质量图片 持久为qq域名
|
||||||
export async function SignMusicWrapper(id: string = '') {
|
export async function SignMusicWrapper(id: string = '') {
|
||||||
let MusicInfo = await CreateMusicThridWay0(id)!;
|
const MusicInfo = await CreateMusicThridWay0(id)!;
|
||||||
let MusicCard = await SignMusicInternal(MusicInfo.name!, MusicInfo.singer!, MusicInfo.cover!, MusicInfo.mid!, "https://ws.stream.qqmusic.qq.com/" + MusicInfo.url!);
|
const MusicCard = await SignMusicInternal(MusicInfo.name!, MusicInfo.singer!, MusicInfo.cover!, MusicInfo.mid!, "https://ws.stream.qqmusic.qq.com/" + MusicInfo.url!);
|
||||||
return MusicCard;
|
return MusicCard;
|
||||||
}
|
}
|
@@ -18,7 +18,7 @@ export class NTQQSystemApi {
|
|||||||
}
|
}
|
||||||
//1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50
|
//1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50
|
||||||
async getArkJsonCollection(cid: string) {
|
async getArkJsonCollection(cid: string) {
|
||||||
let ret = await NTEventDispatch.CallNoListenerEvent
|
const ret = await NTEventDispatch.CallNoListenerEvent
|
||||||
<(cid: string) => Promise<GeneralCallResult & { arkJson: string }>>(
|
<(cid: string) => Promise<GeneralCallResult & { arkJson: string }>>(
|
||||||
'NodeIKernelCollectionService/collectionArkShare',
|
'NodeIKernelCollectionService/collectionArkShare',
|
||||||
5000,
|
5000,
|
||||||
@@ -28,7 +28,7 @@ export class NTQQSystemApi {
|
|||||||
}
|
}
|
||||||
async BootMiniApp(appfile: string, params: string) {
|
async BootMiniApp(appfile: string, params: string) {
|
||||||
await napCatCore.session.getNodeMiscService().setMiniAppVersion('2.16.4');
|
await napCatCore.session.getNodeMiscService().setMiniAppVersion('2.16.4');
|
||||||
let c = await napCatCore.session.getNodeMiscService().getMiniAppPath();
|
const c = await napCatCore.session.getNodeMiscService().getMiniAppPath();
|
||||||
|
|
||||||
return napCatCore.session.getNodeMiscService().startNewMiniApp(appfile, params);
|
return napCatCore.session.getNodeMiscService().startNewMiniApp(appfile, params);
|
||||||
}
|
}
|
||||||
|
@@ -147,7 +147,7 @@ export class WebApi {
|
|||||||
@CacheClassFuncAsync(3600 * 1000, 'webapi_get_group_members')
|
@CacheClassFuncAsync(3600 * 1000, 'webapi_get_group_members')
|
||||||
async getGroupMembers(GroupCode: string, cached: boolean = true): Promise<WebApiGroupMember[]> {
|
async getGroupMembers(GroupCode: string, cached: boolean = true): Promise<WebApiGroupMember[]> {
|
||||||
//logDebug('webapi 获取群成员', GroupCode);
|
//logDebug('webapi 获取群成员', GroupCode);
|
||||||
let MemberData: Array<WebApiGroupMember> = new Array<WebApiGroupMember>();
|
const MemberData: Array<WebApiGroupMember> = new Array<WebApiGroupMember>();
|
||||||
try {
|
try {
|
||||||
const CookiesObject = await NTQQUserApi.getCookies('qun.qq.com');
|
const CookiesObject = await NTQQUserApi.getCookies('qun.qq.com');
|
||||||
const CookieValue = Object.entries(CookiesObject).map(([key, value]) => `${key}=${value}`).join('; ');
|
const CookieValue = Object.entries(CookiesObject).map(([key, value]) => `${key}=${value}`).join('; ');
|
||||||
@@ -248,7 +248,7 @@ export class WebApi {
|
|||||||
const CookieValue = Object.entries(CookiesObject).map(([key, value]) => `${key}=${value}`).join('; ');
|
const CookieValue = Object.entries(CookiesObject).map(([key, value]) => `${key}=${value}`).join('; ');
|
||||||
const Bkn = WebApi.genBkn(CookiesObject.skey);
|
const Bkn = WebApi.genBkn(CookiesObject.skey);
|
||||||
async function getDataInternal(Internal_groupCode: string, Internal_type: number) {
|
async function getDataInternal(Internal_groupCode: string, Internal_type: number) {
|
||||||
let url = 'https://qun.qq.com/interactive/honorlist?gc=' + Internal_groupCode + '&type=' + Internal_type.toString();
|
const url = 'https://qun.qq.com/interactive/honorlist?gc=' + Internal_groupCode + '&type=' + Internal_type.toString();
|
||||||
let res = '';
|
let res = '';
|
||||||
let resJson;
|
let resJson;
|
||||||
try {
|
try {
|
||||||
@@ -268,11 +268,11 @@ export class WebApi {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
let HonorInfo: any = { group_id: groupCode };
|
const HonorInfo: any = { group_id: groupCode };
|
||||||
|
|
||||||
if (getType === WebHonorType.TALKACTIVE || getType === WebHonorType.ALL) {
|
if (getType === WebHonorType.TALKACTIVE || getType === WebHonorType.ALL) {
|
||||||
try {
|
try {
|
||||||
let RetInternal = await getDataInternal(groupCode, 1);
|
const RetInternal = await getDataInternal(groupCode, 1);
|
||||||
if (!RetInternal) {
|
if (!RetInternal) {
|
||||||
throw new Error('获取龙王信息失败');
|
throw new Error('获取龙王信息失败');
|
||||||
}
|
}
|
||||||
@@ -282,7 +282,7 @@ export class WebApi {
|
|||||||
nickname: RetInternal[0]?.name,
|
nickname: RetInternal[0]?.name,
|
||||||
day_count: 0,
|
day_count: 0,
|
||||||
description: RetInternal[0]?.desc
|
description: RetInternal[0]?.desc
|
||||||
}
|
};
|
||||||
HonorInfo.talkative_list = [];
|
HonorInfo.talkative_list = [];
|
||||||
for (const talkative_ele of RetInternal) {
|
for (const talkative_ele of RetInternal) {
|
||||||
HonorInfo.talkative_list.push({
|
HonorInfo.talkative_list.push({
|
||||||
@@ -299,7 +299,7 @@ export class WebApi {
|
|||||||
}
|
}
|
||||||
if (getType === WebHonorType.PERFROMER || getType === WebHonorType.ALL) {
|
if (getType === WebHonorType.PERFROMER || getType === WebHonorType.ALL) {
|
||||||
try {
|
try {
|
||||||
let RetInternal = await getDataInternal(groupCode, 2);
|
const RetInternal = await getDataInternal(groupCode, 2);
|
||||||
if (!RetInternal) {
|
if (!RetInternal) {
|
||||||
throw new Error('获取群聊之火失败');
|
throw new Error('获取群聊之火失败');
|
||||||
}
|
}
|
||||||
@@ -318,7 +318,7 @@ export class WebApi {
|
|||||||
}
|
}
|
||||||
if (getType === WebHonorType.PERFROMER || getType === WebHonorType.ALL) {
|
if (getType === WebHonorType.PERFROMER || getType === WebHonorType.ALL) {
|
||||||
try {
|
try {
|
||||||
let RetInternal = await getDataInternal(groupCode, 3);
|
const RetInternal = await getDataInternal(groupCode, 3);
|
||||||
if (!RetInternal) {
|
if (!RetInternal) {
|
||||||
throw new Error('获取群聊炽焰失败');
|
throw new Error('获取群聊炽焰失败');
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ export class WebApi {
|
|||||||
}
|
}
|
||||||
if (getType === WebHonorType.EMOTION || getType === WebHonorType.ALL) {
|
if (getType === WebHonorType.EMOTION || getType === WebHonorType.ALL) {
|
||||||
try {
|
try {
|
||||||
let RetInternal = await getDataInternal(groupCode, 6);
|
const RetInternal = await getDataInternal(groupCode, 6);
|
||||||
if (!RetInternal) {
|
if (!RetInternal) {
|
||||||
throw new Error('获取快乐源泉失败');
|
throw new Error('获取快乐源泉失败');
|
||||||
}
|
}
|
||||||
|
@@ -45,17 +45,17 @@ export class NapCatCore {
|
|||||||
MsgApi: new NTQQMsgApi(this.context,this),
|
MsgApi: new NTQQMsgApi(this.context,this),
|
||||||
UserApi: new NTQQUserApi(this.context,this),
|
UserApi: new NTQQUserApi(this.context,this),
|
||||||
GroupApi: new NTQQGroupApi(this.context,this)
|
GroupApi: new NTQQGroupApi(this.context,this)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
getApiContext() {
|
getApiContext() {
|
||||||
return this.ApiContext;
|
return this.ApiContext;
|
||||||
}
|
}
|
||||||
// Renamed from 'InitDataListener'
|
// Renamed from 'InitDataListener'
|
||||||
async initNapCatCoreListeners() {
|
async initNapCatCoreListeners() {
|
||||||
let msgListener = new MsgListener();
|
const msgListener = new MsgListener();
|
||||||
msgListener.onRecvMsg = (msg) => {
|
msgListener.onRecvMsg = (msg) => {
|
||||||
console.log("RecvMsg", msg);
|
console.log("RecvMsg", msg);
|
||||||
}
|
};
|
||||||
//await sleep(2500);
|
//await sleep(2500);
|
||||||
this.context.session.getMsgService().addKernelMsgListener(
|
this.context.session.getMsgService().addKernelMsgListener(
|
||||||
new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msgListener, this.context.logger))
|
new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msgListener, this.context.logger))
|
||||||
|
@@ -18,7 +18,7 @@ export interface CacheScanResult {
|
|||||||
export interface ChatCacheList {
|
export interface ChatCacheList {
|
||||||
pageCount: number;
|
pageCount: number;
|
||||||
infos: ChatCacheListItem[]
|
infos: ChatCacheListItem[]
|
||||||
};
|
}
|
||||||
|
|
||||||
export interface ChatCacheListItem {
|
export interface ChatCacheListItem {
|
||||||
chatType: ChatType;
|
chatType: ChatType;
|
||||||
|
@@ -3,4 +3,4 @@ export * from './group';
|
|||||||
export * from './msg';
|
export * from './msg';
|
||||||
export * from './notify';
|
export * from './notify';
|
||||||
export * from './cache';
|
export * from './cache';
|
||||||
export * from './system'
|
export * from './system';
|
||||||
|
@@ -504,7 +504,7 @@ export interface PicElement {
|
|||||||
thumbPath: Map<number, string>;
|
thumbPath: Map<number, string>;
|
||||||
originImageMd5?: string;
|
originImageMd5?: string;
|
||||||
originImageUrl?: string; // http url, 没有host,host是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn
|
originImageUrl?: string; // http url, 没有host,host是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn
|
||||||
};
|
}
|
||||||
|
|
||||||
export enum GrayTipElementSubType {
|
export enum GrayTipElementSubType {
|
||||||
INVITE_NEW_MEMBER = 12,
|
INVITE_NEW_MEMBER = 12,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { SelfInfo } from "./user"
|
import { SelfInfo } from "./user";
|
||||||
|
|
||||||
export interface LineDevice {
|
export interface LineDevice {
|
||||||
instanceId: number
|
instanceId: number
|
||||||
|
@@ -2,4 +2,4 @@ export * from './core';
|
|||||||
export * from './wrapper';
|
export * from './wrapper';
|
||||||
export * from './entities';
|
export * from './entities';
|
||||||
export * from './services';
|
export * from './services';
|
||||||
export * from './listeners'
|
export * from './listeners';
|
||||||
|
@@ -171,7 +171,7 @@ export interface NodeIKernelGroupService {
|
|||||||
|
|
||||||
clearGroupNotifies(groupCode: string): void;
|
clearGroupNotifies(groupCode: string): void;
|
||||||
|
|
||||||
getGroupNotifiesUnreadCount(unknown: Boolean): Promise<GeneralCallResult>;
|
getGroupNotifiesUnreadCount(unknown: boolean): Promise<GeneralCallResult>;
|
||||||
|
|
||||||
clearGroupNotifiesUnreadCount(groupCode: string): void;
|
clearGroupNotifiesUnreadCount(groupCode: string): void;
|
||||||
|
|
||||||
|
@@ -13,4 +13,4 @@ export * from './NodeIKernelStorageCleanService';
|
|||||||
export * from './NodeIKernelRobotService';
|
export * from './NodeIKernelRobotService';
|
||||||
export * from './NodeIKernelRichMediaService';
|
export * from './NodeIKernelRichMediaService';
|
||||||
export * from './NodeIKernelDbToolsService';
|
export * from './NodeIKernelDbToolsService';
|
||||||
export * from './NodeIKernelTipOffService'
|
export * from './NodeIKernelTipOffService';
|
||||||
|
@@ -6,7 +6,7 @@ import { getMachineId, hostname, systemName, systemVersion } from "@/common/util
|
|||||||
export async function genSessionConfig(QQVersionAppid: string, QQVersion: string, selfUin: string, selfUid: string, account_path: string): Promise<WrapperSessionInitConfig> {
|
export async function genSessionConfig(QQVersionAppid: string, QQVersion: string, selfUin: string, selfUid: string, account_path: string): Promise<WrapperSessionInitConfig> {
|
||||||
const downloadPath = path.join(account_path, 'NapCat', 'temp');
|
const downloadPath = path.join(account_path, 'NapCat', 'temp');
|
||||||
fs.mkdirSync(downloadPath, { recursive: true });
|
fs.mkdirSync(downloadPath, { recursive: true });
|
||||||
let guid: string = await getMachineId();//26702 支持JS获取guid值 在LoginService中获取 TODO mlikiow a
|
const guid: string = await getMachineId();//26702 支持JS获取guid值 在LoginService中获取 TODO mlikiow a
|
||||||
const config: WrapperSessionInitConfig = {
|
const config: WrapperSessionInitConfig = {
|
||||||
selfUin,
|
selfUin,
|
||||||
selfUid,
|
selfUid,
|
||||||
|
Reference in New Issue
Block a user