mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: type
This commit is contained in:
parent
99ca79ac7d
commit
56ec8559a0
@ -1,14 +1,21 @@
|
|||||||
export enum GroupNotifyTypes {
|
export enum GroupNotifyMsgType {
|
||||||
INVITE_ME = 1,
|
UN_SPECIFIED,
|
||||||
INVITED_JOIN = 4, // 有人接受了邀请入群
|
INVITED_BY_MEMBER,
|
||||||
JOIN_REQUEST = 7,
|
REFUSE_INVITED,
|
||||||
ADMIN_SET = 8,
|
REFUSED_BY_ADMINI_STRATOR,
|
||||||
KICK_MEMBER = 9,
|
AGREED_TOJOIN_DIRECT,// 有人接受了邀请入群
|
||||||
MEMBER_EXIT = 11, // 主动退出
|
INVITED_NEED_ADMINI_STRATOR_PASS,
|
||||||
ADMIN_UNSET = 12,
|
AGREED_TO_JOIN_BY_ADMINI_STRATOR,
|
||||||
ADMIN_UNSET_OTHER = 13, // 其他人取消管理员
|
REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS,
|
||||||
|
SET_ADMIN,
|
||||||
|
KICK_MEMBER_NOTIFY_ADMIN,
|
||||||
|
KICK_MEMBER_NOTIFY_KICKED,
|
||||||
|
MEMBER_LEAVE_NOTIFY_ADMIN,// 主动退出
|
||||||
|
CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
|
CANCEL_ADMIN_NOTIFY_ADMIN,// 其他人取消管理员
|
||||||
|
TRANSFER_GROUP_NOTIFY_OLDOWNER,
|
||||||
|
TRANSFER_GROUP_NOTIFY_ADMIN
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupNotifies {
|
export interface GroupNotifies {
|
||||||
doubt: boolean;
|
doubt: boolean;
|
||||||
nextStartSeq: string;
|
nextStartSeq: string;
|
||||||
@ -25,7 +32,7 @@ export enum GroupNotifyStatus {
|
|||||||
export interface GroupNotify {
|
export interface GroupNotify {
|
||||||
time: number; // 自己添加的字段,时间戳,毫秒, 用于判断收到短时间内收到重复的notify
|
time: number; // 自己添加的字段,时间戳,毫秒, 用于判断收到短时间内收到重复的notify
|
||||||
seq: string; // 唯一标识符,转成数字再除以1000应该就是时间戳?
|
seq: string; // 唯一标识符,转成数字再除以1000应该就是时间戳?
|
||||||
type: GroupNotifyTypes;
|
type: GroupNotifyMsgType;
|
||||||
status: GroupNotifyStatus; // 0是已忽略?,1是未处理,2是已同意
|
status: GroupNotifyStatus; // 0是已忽略?,1是未处理,2是已同意
|
||||||
group: { groupCode: string; groupName: string };
|
group: { groupCode: string; groupName: string };
|
||||||
user1: { uid: string; nickName: string }; // 被设置管理员的人
|
user1: { uid: string; nickName: string }; // 被设置管理员的人
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
GroupExtParam,
|
GroupExtParam,
|
||||||
GroupMember,
|
GroupMember,
|
||||||
GroupMemberRole,
|
GroupMemberRole,
|
||||||
GroupNotifyTypes,
|
GroupNotifyMsgType,
|
||||||
GroupRequestOperateTypes,
|
GroupRequestOperateTypes,
|
||||||
} from '@/core/entities';
|
} from '@/core/entities';
|
||||||
import { GeneralCallResult } from '@/core/services/common';
|
import { GeneralCallResult } from '@/core/services/common';
|
||||||
@ -195,7 +195,7 @@ export interface NodeIKernelGroupService {
|
|||||||
operateType: GroupRequestOperateTypes, // 2 拒绝
|
operateType: GroupRequestOperateTypes, // 2 拒绝
|
||||||
targetMsg: {
|
targetMsg: {
|
||||||
seq: string, // 通知序列号
|
seq: string, // 通知序列号
|
||||||
type: GroupNotifyTypes,
|
type: GroupNotifyMsgType,
|
||||||
groupCode: string,
|
groupCode: string,
|
||||||
postscript: string
|
postscript: string
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ import {
|
|||||||
BuddyReqType,
|
BuddyReqType,
|
||||||
ChatType,
|
ChatType,
|
||||||
GroupListener,
|
GroupListener,
|
||||||
GroupNotifyTypes,
|
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
MsgListener,
|
MsgListener,
|
||||||
NapCatCore,
|
NapCatCore,
|
||||||
RawMessage,
|
RawMessage,
|
||||||
SendStatusType,
|
SendStatusType,
|
||||||
GroupMemberRole,
|
GroupMemberRole,
|
||||||
|
GroupNotifyMsgType,
|
||||||
} from '@/core';
|
} from '@/core';
|
||||||
import { OB11Config, OB11ConfigLoader } from '@/onebot/helper/config';
|
import { OB11Config, OB11ConfigLoader } from '@/onebot/helper/config';
|
||||||
import { OneBotApiContextType } from '@/onebot/types';
|
import { OneBotApiContextType } from '@/onebot/types';
|
||||||
@ -321,9 +321,9 @@ export class NapCatOneBot11Adapter {
|
|||||||
groupListener.onGroupNotifiesUpdated = async (_, notifies) => {
|
groupListener.onGroupNotifiesUpdated = async (_, notifies) => {
|
||||||
//console.log('ob11 onGroupNotifiesUpdated', notifies[0]);
|
//console.log('ob11 onGroupNotifiesUpdated', notifies[0]);
|
||||||
if (![
|
if (![
|
||||||
GroupNotifyTypes.ADMIN_SET,
|
GroupNotifyMsgType.SET_ADMIN,
|
||||||
GroupNotifyTypes.ADMIN_UNSET,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
GroupNotifyTypes.ADMIN_UNSET_OTHER,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN,
|
||||||
].includes(notifies[0]?.type)) {
|
].includes(notifies[0]?.type)) {
|
||||||
for (const notify of notifies) {
|
for (const notify of notifies) {
|
||||||
notify.time = Date.now();
|
notify.time = Date.now();
|
||||||
@ -337,9 +337,9 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.context.logger.logDebug('收到群通知', notify);
|
this.context.logger.logDebug('收到群通知', notify);
|
||||||
|
|
||||||
if ([
|
if ([
|
||||||
GroupNotifyTypes.ADMIN_SET,
|
GroupNotifyMsgType.SET_ADMIN,
|
||||||
GroupNotifyTypes.ADMIN_UNSET,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
GroupNotifyTypes.ADMIN_UNSET_OTHER,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN,
|
||||||
].includes(notify.type)) {
|
].includes(notify.type)) {
|
||||||
const member1 = await this.core.apis.GroupApi.getGroupMember(notify.group.groupCode, notify.user1.uid);
|
const member1 = await this.core.apis.GroupApi.getGroupMember(notify.group.groupCode, notify.user1.uid);
|
||||||
this.context.logger.logDebug('有管理员变动通知');
|
this.context.logger.logDebug('有管理员变动通知');
|
||||||
@ -348,20 +348,21 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.context.logger.logDebug('开始获取变动的管理员');
|
this.context.logger.logDebug('开始获取变动的管理员');
|
||||||
if (member1) {
|
if (member1) {
|
||||||
this.context.logger.logDebug('变动管理员获取成功');
|
this.context.logger.logDebug('变动管理员获取成功');
|
||||||
// member1.role = notify.type == GroupNotifyTypes.ADMIN_SET ? GroupMemberRole.admin : GroupMemberRole.normal;
|
|
||||||
|
|
||||||
const groupAdminNoticeEvent = new OB11GroupAdminNoticeEvent(
|
const groupAdminNoticeEvent = new OB11GroupAdminNoticeEvent(
|
||||||
this.core,
|
this.core,
|
||||||
parseInt(notify.group.groupCode),
|
parseInt(notify.group.groupCode),
|
||||||
parseInt(member1.uin),
|
parseInt(member1.uin),
|
||||||
[GroupNotifyTypes.ADMIN_UNSET, GroupNotifyTypes.ADMIN_UNSET_OTHER].includes(notify.type) ? 'unset' : 'set',
|
[
|
||||||
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN
|
||||||
|
].includes(notify.type) ? 'unset' : 'set',
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupAdminNoticeEvent)
|
this.networkManager.emitEvent(groupAdminNoticeEvent)
|
||||||
.catch(e => this.context.logger.logError('处理群管理员变动失败', e));
|
.catch(e => this.context.logger.logError('处理群管理员变动失败', e));
|
||||||
} else {
|
} else {
|
||||||
this.context.logger.logDebug('获取群通知的成员信息失败', notify, this.core.apis.GroupApi.getGroup(notify.group.groupCode));
|
this.context.logger.logDebug('获取群通知的成员信息失败', notify, this.core.apis.GroupApi.getGroup(notify.group.groupCode));
|
||||||
}
|
}
|
||||||
} else if (notify.type == GroupNotifyTypes.MEMBER_EXIT || notify.type == GroupNotifyTypes.KICK_MEMBER) {
|
} else if (notify.type == GroupNotifyMsgType.MEMBER_LEAVE_NOTIFY_ADMIN || notify.type == GroupNotifyMsgType.KICK_MEMBER_NOTIFY_ADMIN) {
|
||||||
this.context.logger.logDebug('有成员退出通知', notify);
|
this.context.logger.logDebug('有成员退出通知', notify);
|
||||||
const member1Uin = (await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid))!;
|
const member1Uin = (await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid))!;
|
||||||
let operatorId = member1Uin;
|
let operatorId = member1Uin;
|
||||||
@ -385,7 +386,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
.catch(e => this.context.logger.logError('处理群成员退出失败', e));
|
.catch(e => this.context.logger.logError('处理群成员退出失败', e));
|
||||||
// notify.status == 1 表示未处理 2表示处理完成
|
// notify.status == 1 表示未处理 2表示处理完成
|
||||||
} else if ([
|
} else if ([
|
||||||
GroupNotifyTypes.JOIN_REQUEST,
|
GroupNotifyMsgType.REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS,
|
||||||
].includes(notify.type) && notify.status == 1) {
|
].includes(notify.type) && notify.status == 1) {
|
||||||
this.context.logger.logDebug('有加群请求');
|
this.context.logger.logDebug('有加群请求');
|
||||||
try {
|
try {
|
||||||
@ -406,7 +407,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.context.logger.logError('获取加群人QQ号失败 Uid:', notify.user1.uid, e);
|
this.context.logger.logError('获取加群人QQ号失败 Uid:', notify.user1.uid, e);
|
||||||
}
|
}
|
||||||
} else if (notify.type == GroupNotifyTypes.INVITE_ME && notify.status == 1) {
|
} else if (notify.type == GroupNotifyMsgType.INVITED_BY_MEMBER && notify.status == 1) {
|
||||||
this.context.logger.logDebug(`收到邀请我加群通知:${notify}`);
|
this.context.logger.logDebug(`收到邀请我加群通知:${notify}`);
|
||||||
const groupInviteEvent = new OB11GroupRequestEvent(
|
const groupInviteEvent = new OB11GroupRequestEvent(
|
||||||
this.core,
|
this.core,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user