This commit is contained in:
手瓜一十雪
2025-08-15 19:00:57 +08:00
9 changed files with 508 additions and 160 deletions

View File

@@ -142,7 +142,6 @@ export class NTQQMsgApi {
}
async queryFirstMsgBySender(peer: Peer, SendersUid: string[]) {
console.log(peer, SendersUid);
return await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
chatInfo: peer,
filterMsgType: [],

View File

@@ -1,5 +1,5 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { NTGroupRequestOperateTypes } from '@/core/types';
import { GroupNotify, NTGroupRequestOperateTypes } from '@/core/types';
import { ActionName } from '@/onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
@@ -7,6 +7,7 @@ const SchemaData = Type.Object({
flag: Type.Union([Type.String(), Type.Number()]),
approve: Type.Optional(Type.Union([Type.Boolean(), Type.String()])),
reason: Type.Optional(Type.Union([Type.String({ default: ' ' }), Type.Null()])),
count: Type.Optional(Type.Number({ default: 100 })),
});
type Payload = Static<typeof SchemaData>;
@@ -19,8 +20,12 @@ export default class SetGroupAddRequest extends OneBotAction<Payload, null> {
const flag = payload.flag.toString();
const approve = payload.approve?.toString() !== 'false';
const reason = payload.reason ?? ' ';
const count = payload.count;
const invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(flag);
const { doubt, notify } = invite_notify ? { doubt: false, notify: invite_notify } : await this.findNotify(flag);
const { doubt, notify } = invite_notify ? {
doubt: false,
notify: invite_notify,
} : await this.findNotify(flag, count);
if (!notify) {
throw new Error('No such request');
}
@@ -33,12 +38,15 @@ export default class SetGroupAddRequest extends OneBotAction<Payload, null> {
return null;
}
private async findNotify(flag: string) {
let notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(false, 100)).find(e => e.seq == flag);
private async findNotify(flag: string, count: number = 100): Promise<{
doubt: boolean,
notify: GroupNotify | undefined
}> {
let notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(false, count)).find(e => e.seq == flag);
if (!notify) {
notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(true, 100)).find(e => e.seq == flag);
notify = (await this.core.apis.GroupApi.getSingleScreenNotifies(true, count)).find(e => e.seq == flag);
return { doubt: true, notify };
}
return { doubt: false, notify };
}
}
}

View File

@@ -1,5 +1,6 @@
import { NapCatOneBot11Adapter, OB11Message } from '@/onebot';
import { ChatType, NapCatCore } from '@/core';
import { ChatType, NapCatCore } from '@/core';
import { ActionMap } from '@/onebot/action';
import { OB11PluginAdapter } from '@/onebot/network/plugin';

View File

@@ -1,2 +1,4 @@
//export * from '@/common/performance-monitor';
import { NCoreInitShell } from './base';
NCoreInitShell();