mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 13:01:14 +00:00
Merge branch 'main' into upmain
This commit is contained in:
commit
0cf13a284c
@ -7,6 +7,8 @@ import {
|
||||
GroupNotify,
|
||||
GroupRequestOperateTypes,
|
||||
InstanceContext,
|
||||
KickMemberInfo,
|
||||
kickMemberV2Req,
|
||||
MemberExtSourceType,
|
||||
NapCatCore,
|
||||
NodeIKernelGroupListener,
|
||||
@ -42,12 +44,12 @@ export class NTQQGroupApi {
|
||||
type ListenerType = NodeIKernelGroupListener['onGroupListUpdate'];
|
||||
const [_retData, _updateType, groupList] = await this.core.eventWrapper.CallNormalEvent<(force: boolean) => Promise<any>, ListenerType>
|
||||
(
|
||||
'NodeIKernelGroupService/getGroupList',
|
||||
'NodeIKernelGroupListener/onGroupListUpdate',
|
||||
1,
|
||||
5000,
|
||||
() => true,
|
||||
forced,
|
||||
'NodeIKernelGroupService/getGroupList',
|
||||
'NodeIKernelGroupListener/onGroupListUpdate',
|
||||
1,
|
||||
5000,
|
||||
() => true,
|
||||
forced,
|
||||
);
|
||||
return groupList;
|
||||
}
|
||||
@ -219,7 +221,17 @@ export class NTQQGroupApi {
|
||||
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
||||
return this.context.session.getGroupService().addGroupEssence(param);
|
||||
}
|
||||
|
||||
async kickMemberV2Inner(param: kickMemberV2Req) {
|
||||
return this.context.session.getGroupService().kickMemberV2(param);
|
||||
}
|
||||
async quitGroupV2(GroupCode: string, needDeleteLocalMsg: boolean) {
|
||||
let param = {
|
||||
groupCode: GroupCode,
|
||||
needDeleteLocalMsg: needDeleteLocalMsg
|
||||
};
|
||||
//应该是直接返回不需要Listener的 未经测试 需测试再发布
|
||||
return this.context.session.getGroupService().quitGroupV2(param);
|
||||
}
|
||||
async removeGroupEssence(GroupCode: string, msgId: string) {
|
||||
// 代码没测过
|
||||
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
||||
@ -240,14 +252,14 @@ export class NTQQGroupApi {
|
||||
async getSingleScreenNotifies(num: number) {
|
||||
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>
|
||||
(
|
||||
'NodeIKernelGroupService/getSingleScreenNotifies',
|
||||
'NodeIKernelGroupListener/onGroupSingleScreenNotifies',
|
||||
1,
|
||||
5000,
|
||||
() => true,
|
||||
false,
|
||||
'',
|
||||
num,
|
||||
'NodeIKernelGroupService/getSingleScreenNotifies',
|
||||
'NodeIKernelGroupListener/onGroupSingleScreenNotifies',
|
||||
1,
|
||||
5000,
|
||||
() => true,
|
||||
false,
|
||||
'',
|
||||
num,
|
||||
);
|
||||
return notifies;
|
||||
}
|
||||
@ -259,12 +271,12 @@ export class NTQQGroupApi {
|
||||
//return napCatCore.session.getGroupService().getMemberInfo(GroupCode, [uid], forced);
|
||||
const Listener = this.core.eventWrapper.RegisterListen<(params: any) => void>
|
||||
(
|
||||
'NodeIKernelGroupListener/onMemberInfoChange',
|
||||
1,
|
||||
forced ? 5000 : 250,
|
||||
(params) => {
|
||||
return params === GroupCode;
|
||||
},
|
||||
'NodeIKernelGroupListener/onMemberInfoChange',
|
||||
1,
|
||||
forced ? 5000 : 250,
|
||||
(params) => {
|
||||
return params === GroupCode;
|
||||
},
|
||||
);
|
||||
const EventFunc = this.core.eventWrapper.createEventFunction<EventType>('NodeIKernelGroupService/getMemberInfo');
|
||||
const retData = await EventFunc!(GroupCode, [uid], forced);
|
||||
@ -333,7 +345,7 @@ export class NTQQGroupApi {
|
||||
'NodeIKernelGroupService/getGroupRecommendContactArkJson',
|
||||
5000,
|
||||
GroupCode,
|
||||
);
|
||||
);
|
||||
return ret.arkJson;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
import { QQLevel, Sex, User } from './user';
|
||||
|
||||
export interface KickMemberInfo {
|
||||
optFlag: number,
|
||||
optOperate: number,
|
||||
optMemberUid: string,
|
||||
optBytesMsg: string,
|
||||
}
|
||||
export interface kickMemberV2Req{
|
||||
groupCode: string,
|
||||
kickFlag: number,
|
||||
kickList: Array<KickMemberInfo>,
|
||||
kickListUids: Array<string>,
|
||||
kickMsg: string
|
||||
}
|
||||
export enum GroupListUpdateType {
|
||||
REFRESHALL,
|
||||
GETALL,
|
||||
|
@ -41,8 +41,7 @@ export enum GroupInviteType {
|
||||
BYDISCUSSMEMBER
|
||||
}
|
||||
export interface GroupNotify {
|
||||
time: number; // 自己添加的字段,时间戳,毫秒, 用于判断收到短时间内收到重复的notify
|
||||
seq: string; // 唯一标识符,转成数字再除以1000应该就是时间戳?
|
||||
seq: string; // 通知序列号
|
||||
type: GroupNotifyMsgType;
|
||||
status: GroupNotifyMsgStatus;
|
||||
group: { groupCode: string; groupName: string };
|
||||
|
@ -5,12 +5,16 @@ import {
|
||||
GroupMemberRole,
|
||||
GroupNotifyMsgType,
|
||||
GroupRequestOperateTypes,
|
||||
kickMemberV2Req,
|
||||
} from '@/core/entities';
|
||||
import { GeneralCallResult } from '@/core/services/common';
|
||||
|
||||
//高版本的接口不应该随意使用 使用应该严格进行pr审核 同时部分ipc中未出现的接口不要过于依赖 应该做好数据兜底
|
||||
|
||||
export interface NodeIKernelGroupService {
|
||||
kickMemberV2(param: kickMemberV2Req): Promise<GeneralCallResult>;
|
||||
quitGroupV2(param: { groupCode: string; needDeleteLocalMsg: boolean; }): Promise<GeneralCallResult>;
|
||||
|
||||
getMemberCommonInfo(Req: {
|
||||
groupCode: string,
|
||||
startUin: string,
|
||||
|
@ -327,7 +327,6 @@ export class NapCatOneBot11Adapter {
|
||||
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN,
|
||||
].includes(notifies[0]?.type)) {
|
||||
for (const notify of notifies) {
|
||||
notify.time = Date.now();
|
||||
const notifyTime = parseInt(notify.seq) / 1000 / 1000;
|
||||
// log(`群通知时间${notifyTime}`, `启动时间${this.bootTime}`);
|
||||
if (notifyTime < this.bootTime) {
|
||||
|
Loading…
Reference in New Issue
Block a user