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
|
// groupCode -> Group
|
||||||
export const groups: Map<string, Group> = new Map<string, 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)
|
// 群号 -> 群成员map(uid=>GroupMember)
|
||||||
export const groupMembers: Map<string, Map<string, GroupMember>> = new Map<string, Map<string, 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 { OB11GroupCardEvent } from './event/notice/OB11GroupCardEvent';
|
||||||
import { OB11GroupDecreaseEvent } from './event/notice/OB11GroupDecreaseEvent';
|
import { OB11GroupDecreaseEvent } from './event/notice/OB11GroupDecreaseEvent';
|
||||||
import { ob11Config } from '@/onebot11/config';
|
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 {
|
export class OB11Constructor {
|
||||||
@ -322,11 +323,17 @@ export class OB11Constructor {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
} else if (groupElement.type == TipGroupElementType.kicked) {
|
} else if (groupElement.type == TipGroupElementType.kicked) {
|
||||||
log('收到我被踢出提示', groupElement);
|
log(`收到我被踢出或退群提示, 群${msg.peerUid}`, groupElement);
|
||||||
const adminUin = (await getGroupMember(msg.peerUid, groupElement.adminUid))?.uin; //|| (await NTQQUserApi.getUserDetailInfo(groupElement.adminUid))?.uin
|
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) {
|
if (adminUin) {
|
||||||
return new OB11GroupDecreaseEvent(parseInt(msg.peerUid), parseInt(selfInfo.uin), parseInt(adminUin), 'kick_me');
|
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) {
|
} else if (element.fileElement) {
|
||||||
return new OB11GroupUploadNoticeEvent(parseInt(msg.peerUid), parseInt(msg.senderUin || ''), {
|
return new OB11GroupUploadNoticeEvent(parseInt(msg.peerUid), parseInt(msg.senderUin || ''), {
|
||||||
|
@ -29,7 +29,7 @@ import { OB11GroupRecallNoticeEvent } from '@/onebot11/event/notice/OB11GroupRec
|
|||||||
|
|
||||||
|
|
||||||
export class NapCatOnebot11 {
|
export class NapCatOnebot11 {
|
||||||
private bootTime: number = Date.now() / 1000;
|
private bootTime: number = Date.now() / 1000; // 秒
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -130,7 +130,6 @@ export class NapCatOnebot11 {
|
|||||||
// if (message.senderUin !== selfInfo.uin){
|
// if (message.senderUin !== selfInfo.uin){
|
||||||
// message.msgShortId = await dbUtil.addMsg(message);
|
// message.msgShortId = await dbUtil.addMsg(message);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
OB11Constructor.message(message).then((msg) => {
|
OB11Constructor.message(message).then((msg) => {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
msg.raw = message;
|
msg.raw = message;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user