mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8fb8c888f5 | ||
![]() |
4a2884509e |
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "4.2.19",
|
"version": "4.2.20",
|
||||||
"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": "4.2.19",
|
"version": "4.2.20",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
|
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
|
||||||
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",
|
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '4.2.19';
|
export const napCatVersion = '4.2.20';
|
||||||
|
@@ -8,14 +8,10 @@ import { LRUCache } from '@/common/lru-cache';
|
|||||||
export class NTQQUserApi {
|
export class NTQQUserApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
private uidCache: LRUCache<string, string>;
|
|
||||||
private uinCache: LRUCache<string, string>;
|
|
||||||
|
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
this.uidCache = new LRUCache(1000);
|
|
||||||
this.uinCache = new LRUCache(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCoreAndBaseInfo(uids: string[]) {
|
async getCoreAndBaseInfo(uids: string[]) {
|
||||||
@@ -174,9 +170,6 @@ export class NTQQUserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getUidByUinV2(Uin: string) {
|
async getUidByUinV2(Uin: string) {
|
||||||
if (this.uidCache.get(Uin)) {
|
|
||||||
return this.uidCache.get(Uin);
|
|
||||||
}
|
|
||||||
const services = [
|
const services = [
|
||||||
() => this.context.session.getUixConvertService().getUid([Uin]).then((data) => data.uidInfo.get(Uin)).catch(() => undefined),
|
() => this.context.session.getUixConvertService().getUid([Uin]).then((data) => data.uidInfo.get(Uin)).catch(() => undefined),
|
||||||
() => promisify<string, string[], Map<string, string>>
|
() => promisify<string, string[], Map<string, string>>
|
||||||
@@ -188,7 +181,6 @@ export class NTQQUserApi {
|
|||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
uid = await service();
|
uid = await service();
|
||||||
if (uid && uid.indexOf('*') == -1 && uid !== '') {
|
if (uid && uid.indexOf('*') == -1 && uid !== '') {
|
||||||
this.uidCache.put(Uin, uid);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,9 +188,6 @@ export class NTQQUserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getUinByUidV2(Uid: string) {
|
async getUinByUidV2(Uid: string) {
|
||||||
if (this.uinCache.get(Uid)) {
|
|
||||||
return this.uinCache.get(Uid);
|
|
||||||
}
|
|
||||||
const services = [
|
const services = [
|
||||||
() => this.context.session.getUixConvertService().getUin([Uid]).then((data) => data.uinInfo.get(Uid)).catch(() => undefined),
|
() => this.context.session.getUixConvertService().getUin([Uid]).then((data) => data.uinInfo.get(Uid)).catch(() => undefined),
|
||||||
() => this.context.session.getGroupService().getUinByUids([Uid]).then((data) => data.uins.get(Uid)).catch(() => undefined),
|
() => this.context.session.getGroupService().getUinByUids([Uid]).then((data) => data.uins.get(Uid)).catch(() => undefined),
|
||||||
@@ -211,7 +200,6 @@ export class NTQQUserApi {
|
|||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
uin = await service();
|
uin = await service();
|
||||||
if (uin && uin !== '0' && uin !== '') {
|
if (uin && uin !== '0' && uin !== '') {
|
||||||
this.uinCache.put(Uid, uin);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user