mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: delete group
This commit is contained in:
parent
0773a4f39c
commit
58747d7d4a
@ -18,6 +18,11 @@ export const selfInfo: SelfInfo = {
|
||||
// groupCode -> Group
|
||||
export const groups: Map<string, Group> = new Map<string, Group>();
|
||||
|
||||
export function deleteGroup(groupQQ: string) {
|
||||
groups.delete(groupQQ);
|
||||
groupMembers.delete(groupQQ);
|
||||
}
|
||||
|
||||
// 群号 -> 群成员map(uid=>GroupMember)
|
||||
export const groupMembers: Map<string, Map<string, GroupMember>> = new Map<string, Map<string, GroupMember>>();
|
||||
|
||||
|
@ -38,7 +38,8 @@ import { OB11GroupTitleEvent } from './event/notice/OB11GroupTitleEvent';
|
||||
import { OB11GroupCardEvent } from './event/notice/OB11GroupCardEvent';
|
||||
import { OB11GroupDecreaseEvent } from './event/notice/OB11GroupDecreaseEvent';
|
||||
import { ob11Config } from '@/onebot11/config';
|
||||
import { getFriend, getGroupMember, groupMembers, selfInfo, tempGroupCodeMap } from '@/common/data';
|
||||
import { deleteGroup, getFriend, getGroupMember, groupMembers, selfInfo, tempGroupCodeMap } from '@/common/data';
|
||||
import { NTQQGroupApi, NTQQUserApi } from '@/core/qqnt/apis';
|
||||
|
||||
|
||||
export class OB11Constructor {
|
||||
@ -322,10 +323,16 @@ export class OB11Constructor {
|
||||
return event;
|
||||
}
|
||||
} else if (groupElement.type == TipGroupElementType.kicked) {
|
||||
log('收到我被踢出提示', groupElement);
|
||||
const adminUin = (await getGroupMember(msg.peerUid, groupElement.adminUid))?.uin; //|| (await NTQQUserApi.getUserDetailInfo(groupElement.adminUid))?.uin
|
||||
if (adminUin) {
|
||||
return new OB11GroupDecreaseEvent(parseInt(msg.peerUid), parseInt(selfInfo.uin), parseInt(adminUin), 'kick_me');
|
||||
log(`收到我被踢出或退群提示, 群${msg.peerUid}`, groupElement);
|
||||
deleteGroup(msg.peerUid);
|
||||
NTQQGroupApi.quitGroup(msg.peerUid).then();
|
||||
try {
|
||||
const adminUin = (await getGroupMember(msg.peerUid, groupElement.adminUid))?.uin || (await NTQQUserApi.getUserDetailInfo(groupElement.adminUid))?.uin;
|
||||
if (adminUin) {
|
||||
return new OB11GroupDecreaseEvent(parseInt(msg.peerUid), parseInt(selfInfo.uin), parseInt(adminUin), 'kick_me');
|
||||
}
|
||||
} catch (e) {
|
||||
return new OB11GroupDecreaseEvent(parseInt(msg.peerUid), parseInt(selfInfo.uin), 0, 'leave');
|
||||
}
|
||||
}
|
||||
} else if (element.fileElement) {
|
||||
|
@ -29,7 +29,7 @@ import { OB11GroupRecallNoticeEvent } from '@/onebot11/event/notice/OB11GroupRec
|
||||
|
||||
|
||||
export class NapCatOnebot11 {
|
||||
private bootTime: number = Date.now() / 1000;
|
||||
private bootTime: number = Date.now() / 1000; // 秒
|
||||
|
||||
|
||||
constructor() {
|
||||
@ -130,7 +130,6 @@ export class NapCatOnebot11 {
|
||||
// if (message.senderUin !== selfInfo.uin){
|
||||
// message.msgShortId = await dbUtil.addMsg(message);
|
||||
// }
|
||||
|
||||
OB11Constructor.message(message).then((msg) => {
|
||||
if (debug) {
|
||||
msg.raw = message;
|
||||
|
Loading…
x
Reference in New Issue
Block a user