refactor: refactor new group member event

feat: group ban event
This commit is contained in:
linyuchen
2024-03-11 09:55:50 +08:00
parent eeadaa12e9
commit 75883e9cae
8 changed files with 118 additions and 39 deletions

View File

@@ -168,24 +168,6 @@ async function processGroupEvent(payload) {
break;
}
}
} else if (existGroup.memberCount < group.memberCount) {
const oldMembers = existGroup.members;
const oldMembersSet = new Set<string>();
for (const member of oldMembers) {
oldMembersSet.add(member.uin);
}
await sleep(200);
const newMembers = await NTQQApi.getGroupMembers(group.groupCode);
group.members = newMembers;
for (const member of newMembers) {
if (!oldMembersSet.has(member.uin)) {
postOB11Event(new OB11GroupIncreaseEvent(group.groupCode, parseInt(member.uin)));
break;
}
}
}
}
}

View File

@@ -112,6 +112,7 @@ export enum PicType {
gif = 2000,
jpg = 1000
}
export interface SendPicElement {
elementType: ElementType.PIC,
elementId: "",
@@ -218,8 +219,8 @@ export interface PttElement {
export interface ArkElement {
bytesData: string;
linkInfo:null,
subElementType:null
linkInfo: null,
subElementType: null
}
export const IMAGE_HTTP_HOST = "https://gchat.qpic.cn"
@@ -245,7 +246,8 @@ export interface GrayTipElement {
operatorMemRemark?: string;
wording: string; // 自定义的撤回提示语
}
aioOpGrayTipElement: TipAioOpGrayTipElement
aioOpGrayTipElement: TipAioOpGrayTipElement,
groupElement: TipGroupElement
}
export interface FaceElement {
@@ -278,15 +280,20 @@ export interface VideoElement {
"sourceVideoCodecFormat": 0
}
export interface TipAioOpGrayTipElement{
export interface TipAioOpGrayTipElement { // 这是什么提示来着?
operateType: number,
peerUid: string,
fromGrpCodeOfTmpChat: string,
}
export enum TipGroupElementType {
memberIncrease = 1,
ban = 8
}
export interface TipGroupElement {
"type": 1, // 1是表示有人加入群, 自己加入群也会收到这个
"role": 0,
"type": TipGroupElementType, // 1是表示有人加入群, 自己加入群也会收到这个
"role": 0, // 暂时不知
"groupName": string, // 暂时获取不到
"memberUid": string,
"memberNick": string,
@@ -295,7 +302,7 @@ export interface TipGroupElement {
"adminNick": string,
"adminRemark": string,
"createGroup": null,
"memberAdd": {
"memberAdd"?: {
"showType": 1,
"otherAdd": null,
"otherAddByOtherQRCode": null,
@@ -305,7 +312,22 @@ export interface TipGroupElement {
"otherInviteYou": null,
"youInviteOther": null
},
"shutUp": null
"shutUp"?: {
"curTime": string,
"duration": string, // 禁言时间,秒
"admin": {
"uid": string,
"card": string,
"name": string,
"role": GroupMemberRole
},
"member": {
"uid": string
"card": string,
"name": string,
"role": GroupMemberRole
}
}
}