mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
88de57f984 | ||
![]() |
61ddf38892 | ||
![]() |
52b3540ec3 | ||
![]() |
5f831958c3 | ||
![]() |
c3d4698af3 | ||
![]() |
bd6e83217d |
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "3.3.20",
|
"version": "3.3.21",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.3.20",
|
"version": "3.3.21",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "vite build --mode framework",
|
"build:framework": "vite build --mode framework",
|
||||||
"build:shell": "vite build --mode shell",
|
"build:shell": "vite build --mode shell",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '3.3.20';
|
export const napCatVersion = '3.3.21';
|
||||||
|
@@ -12,6 +12,7 @@ import {
|
|||||||
import { isNumeric, solveAsyncProblem } from '@/common/helper';
|
import { isNumeric, solveAsyncProblem } from '@/common/helper';
|
||||||
import { LimitedHashTable } from '@/common/message-unique';
|
import { LimitedHashTable } from '@/common/message-unique';
|
||||||
import { NTEventWrapper } from '@/common/event';
|
import { NTEventWrapper } from '@/common/event';
|
||||||
|
import { c } from 'vite/dist/node/types.d-aGj9QkWt';
|
||||||
|
|
||||||
export class NTQQGroupApi {
|
export class NTQQGroupApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@@ -320,10 +321,10 @@ export class NTQQGroupApi {
|
|||||||
infos: Map<string, GroupMember>;
|
infos: Map<string, GroupMember>;
|
||||||
finish: boolean;
|
finish: boolean;
|
||||||
hasNext: boolean | undefined;
|
hasNext: boolean | undefined;
|
||||||
}>{
|
}> {
|
||||||
const sceneId = this.context.session.getGroupService().createMemberListScene(groupQQ, 'groupMemberList_MainWindow_1');
|
const sceneId = this.context.session.getGroupService().createMemberListScene(groupQQ, 'groupMemberList_MainWindow_1');
|
||||||
const once = this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onMemberListChange', 0, timeout, (params) => params.sceneId === sceneId)
|
const once = this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onMemberListChange', 0, timeout, (params) => params.sceneId === sceneId)
|
||||||
.catch(() => {});
|
.catch(() => { });
|
||||||
const result = await this.context.session.getGroupService().getNextMemberList(sceneId, undefined, num);
|
const result = await this.context.session.getGroupService().getNextMemberList(sceneId, undefined, num);
|
||||||
if (result.errCode !== 0) {
|
if (result.errCode !== 0) {
|
||||||
throw new Error('获取群成员列表出错,' + result.errMsg);
|
throw new Error('获取群成员列表出错,' + result.errMsg);
|
||||||
@@ -337,19 +338,20 @@ export class NTQQGroupApi {
|
|||||||
}
|
}
|
||||||
this.context.session.getGroupService().destroyMemberListScene(sceneId);
|
this.context.session.getGroupService().destroyMemberListScene(sceneId);
|
||||||
return {
|
return {
|
||||||
infos: resMode2?.infos || result.result.infos,
|
infos: new Map([...(resMode2?.infos ?? []), ...result.result.infos]),
|
||||||
finish: result.result.finish,
|
finish: result.result.finish,
|
||||||
hasNext: resMode2?.hasNext,
|
hasNext: resMode2?.hasNext,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
||||||
let res = await this.tryGetGroupMembersV2(true, groupQQ);
|
console.log("-start-", groupQQ);
|
||||||
|
let res = await this.tryGetGroupMembersV2(true, groupQQ, 3000);
|
||||||
if (res.hasNext || !res.finish || res.infos.size === 0) {
|
if (res.hasNext || !res.finish || res.infos.size === 0) {
|
||||||
res = await this.tryGetGroupMembersV2(false, groupQQ, num);
|
res = await this.tryGetGroupMembersV2(false, groupQQ, 3000);
|
||||||
}
|
}
|
||||||
if ((res.infos.size === 0 || res.infos.size === 30) && res.finish) {
|
if (res.infos.size === 0 && res.finish) {
|
||||||
res = await this.tryGetGroupMembersV2(true, groupQQ, num);
|
res = await this.tryGetGroupMembersV2(true, groupQQ, 3000);
|
||||||
}
|
}
|
||||||
return res.infos;
|
return res.infos;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ export class NTQQUserApi {
|
|||||||
async getStatusByUid(uid: string) {
|
async getStatusByUid(uid: string) {
|
||||||
return this.context.session.getProfileService().getStatus(uid);
|
return this.context.session.getProfileService().getStatus(uid);
|
||||||
}
|
}
|
||||||
async getProfileLike(uid: string) {
|
async getProfileLike(uid: string, start: number, count: number) {
|
||||||
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
||||||
friendUids: [uid],
|
friendUids: [uid],
|
||||||
basic: 1,
|
basic: 1,
|
||||||
@@ -26,8 +26,8 @@ export class NTQQUserApi {
|
|||||||
favorite: 0,
|
favorite: 0,
|
||||||
userProfile: 1,
|
userProfile: 1,
|
||||||
type: 2,
|
type: 2,
|
||||||
start: 0,
|
start: start,
|
||||||
limit: 20,
|
limit: count,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async fetchOtherProfileLike(uid: string) {
|
async fetchOtherProfileLike(uid: string) {
|
||||||
|
@@ -1,15 +1,22 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
|
|
||||||
export class GetProfileLike extends BaseAction<void, any> {
|
interface Payload {
|
||||||
|
start: number,
|
||||||
|
count: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GetProfileLike extends BaseAction<Payload, any> {
|
||||||
actionName = ActionName.GetProfileLike;
|
actionName = ActionName.GetProfileLike;
|
||||||
|
|
||||||
async _handle(payload: void) {
|
async _handle(payload: Payload) {
|
||||||
const ret = await this.core.apis.UserApi.getProfileLike(this.core.selfInfo.uid);
|
const start = payload.start ? Number(payload.start) : 0;
|
||||||
const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos;
|
const count = payload.count ? Number(payload.count) : 10;
|
||||||
|
const ret = await this.core.apis.UserApi.getProfileLike(this.core.selfInfo.uid, start, count);
|
||||||
|
const listdata: any[] = ret.info.userLikeInfos[0].voteInfo.userInfos;
|
||||||
for (let i = 0; i < listdata.length; i++) {
|
for (let i = 0; i < listdata.length; i++) {
|
||||||
listdata[i].uin = parseInt((await this.core.apis.UserApi.getUinByUidV2(listdata[i].uid)) || '');
|
listdata[i].uin = parseInt((await this.core.apis.UserApi.getUinByUidV2(listdata[i].uid)) || '');
|
||||||
}
|
}
|
||||||
return listdata;
|
return ret.info.userLikeInfos[0].voteInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
import { ChatType, Peer } from '@/core';
|
import { ChatType, Peer } from '@/core';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
eventType: { type: 'string' },
|
event_type: { type: 'number' },
|
||||||
group_id: { type: 'string' },
|
user_id: { type: ['number', 'string'] },
|
||||||
user_id: { type: 'string' },
|
|
||||||
},
|
},
|
||||||
required: ['eventType'],
|
required: ['event_type','user_id'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
type Payload = FromSchema<typeof SchemaData>;
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
@@ -19,23 +18,12 @@ export class SetInputStatus extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.SetInputStatus;
|
actionName = ActionName.SetInputStatus;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
let peer: Peer;
|
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (payload.group_id) {
|
if (!uid) throw new Error('uid is empty');
|
||||||
peer = {
|
const peer = {
|
||||||
chatType: ChatType.KCHATTYPEGROUP,
|
chatType: ChatType.KCHATTYPEC2C,
|
||||||
peerUid: payload.group_id,
|
peerUid: uid,
|
||||||
};
|
};
|
||||||
} else if (payload.user_id) {
|
return await this.core.apis.MsgApi.sendShowInputStatusReq(peer, payload.event_type);
|
||||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id);
|
|
||||||
if (!uid) throw new Error('uid is empty');
|
|
||||||
peer = {
|
|
||||||
chatType: ChatType.KCHATTYPEC2C,
|
|
||||||
peerUid: uid,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
throw new Error('请指定 group_id 或 user_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
return await this.core.apis.MsgApi.sendShowInputStatusReq(peer, parseInt(payload.eventType));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V3.3.20", "napcat-update-button", "secondary")
|
SettingButton("V3.3.21", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user