26 包 monorepo(TS 全源码): - snowcat-core: NT 内核 API 封装 + listener(含 9.9.37 六回调适配)+ Packet 发包 - snowcat-onebot: OneBot v11 全动作 + MCP Streamable HTTP 适配器 + 稳定线 - snowcat-webui-frontend/backend: 雪猫控制台(React+HeroUI) - snowcat-shell: 单文件 bundle 出口(vite inlineDynamicImports) - snowcat-native: napi2native / MoeHoo / ffmpeg / pty 运行时 - 56 项 SnowLuma 独门动作移植(qzone 全家桶/群相册/装扮/闪照/收藏) - 工具件: 解包器/启动器/便携制作器/doctor GitHub 关联已全量指向 DandanLLab/SnowCatQQ
73 lines
2.7 KiB
TypeScript
73 lines
2.7 KiB
TypeScript
import { GroupNotifyMsgStatus } from 'snowcat-core';
|
|
import { OneBotAction } from '@/snowcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/snowcat-onebot/action/router';
|
|
import { Type, Static } from '@sinclair/typebox';
|
|
|
|
const ReturnSchema = Type.Array(
|
|
Type.Object({
|
|
request_id: Type.Number({ description: '请求ID' }),
|
|
invitor_uin: Type.Number({ description: '邀请者QQ' }),
|
|
invitor_nick: Type.Optional(Type.String({ description: '邀请者昵称' })),
|
|
group_id: Type.Number({ description: '群号' }),
|
|
message: Type.Optional(Type.String({ description: '验证信息' })),
|
|
group_name: Type.Optional(Type.String({ description: '群名称' })),
|
|
checked: Type.Boolean({ description: '是否已处理' }),
|
|
actor: Type.Number({ description: '处理者QQ' }),
|
|
requester_nick: Type.Optional(Type.String({ description: '请求者昵称' })),
|
|
}),
|
|
{ description: '群通知列表' }
|
|
);
|
|
|
|
type ReturnType = Static<typeof ReturnSchema>;
|
|
|
|
export default class GetGroupAddRequest extends OneBotAction<void, ReturnType> {
|
|
override actionName = ActionName.GetGroupIgnoreAddRequest;
|
|
override payloadSchema = Type.Object({});
|
|
override returnSchema = ReturnSchema;
|
|
override actionSummary = '获取群被忽略的加群请求';
|
|
override actionTags = ['群组接口'];
|
|
override payloadExample = {};
|
|
override returnExample = [
|
|
{
|
|
request_id: 12345,
|
|
invitor_uin: 123456789,
|
|
invitor_nick: '邀请者',
|
|
group_id: 123456789,
|
|
message: '加群请求',
|
|
group_name: '群名称',
|
|
checked: false,
|
|
actor: 0,
|
|
requester_nick: '请求者',
|
|
},
|
|
];
|
|
|
|
async _handle (): Promise<ReturnType> {
|
|
const NTQQUserApi = this.core.apis.UserApi;
|
|
const NTQQGroupApi = this.core.apis.GroupApi;
|
|
const ignoredNotifies = await NTQQGroupApi.getSingleScreenNotifies(true, 10);
|
|
const retData: ReturnType = [];
|
|
|
|
const notifyPromises = ignoredNotifies
|
|
.filter(notify => notify.type === 7)
|
|
.map(async SSNotify => {
|
|
const invitorUin = SSNotify.user1?.uid ? +await NTQQUserApi.getUinByUidV2(SSNotify.user1.uid) : 0;
|
|
const actorUin = SSNotify.user2?.uid ? +await NTQQUserApi.getUinByUidV2(SSNotify.user2.uid) : 0;
|
|
retData.push({
|
|
request_id: +SSNotify.seq,
|
|
invitor_uin: invitorUin,
|
|
invitor_nick: SSNotify.user1?.nickName,
|
|
group_id: +SSNotify.group?.groupCode,
|
|
message: SSNotify?.postscript,
|
|
group_name: SSNotify.group?.groupName,
|
|
checked: SSNotify.status !== GroupNotifyMsgStatus.KUNHANDLE,
|
|
actor: actorUin,
|
|
requester_nick: SSNotify.user1?.nickName,
|
|
});
|
|
});
|
|
|
|
await Promise.all(notifyPromises);
|
|
|
|
return retData;
|
|
}
|
|
}
|