mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
refactor: essence and together listener
This commit is contained in:
parent
44d350a225
commit
7141ba1587
@ -46,6 +46,7 @@ import { OB11GroupMsgEmojiLikeEvent } from '@/onebot11/event/notice/OB11MsgEmoji
|
|||||||
import { napCatCore } from '@/core';
|
import { napCatCore } from '@/core';
|
||||||
import { OB11FriendPokeEvent, OB11GroupPokeEvent } from './event/notice/OB11PokeEvent';
|
import { OB11FriendPokeEvent, OB11GroupPokeEvent } from './event/notice/OB11PokeEvent';
|
||||||
import { OB11BaseNoticeEvent } from './event/notice/OB11BaseNoticeEvent';
|
import { OB11BaseNoticeEvent } from './event/notice/OB11BaseNoticeEvent';
|
||||||
|
import { OB11GroupEssenceEvent } from './event/notice/OB11GroupEssenceEvent';
|
||||||
|
|
||||||
|
|
||||||
export class OB11Constructor {
|
export class OB11Constructor {
|
||||||
@ -317,7 +318,7 @@ export class OB11Constructor {
|
|||||||
if (msg.chatType !== ChatType.group) {
|
if (msg.chatType !== ChatType.group) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//log("group msg", msg);
|
log("group msg", msg);
|
||||||
if (msg.senderUin && msg.senderUin !== '0') {
|
if (msg.senderUin && msg.senderUin !== '0') {
|
||||||
const member = await getGroupMember(msg.peerUid, msg.senderUin);
|
const member = await getGroupMember(msg.peerUid, msg.senderUin);
|
||||||
if (member && member.cardName !== msg.sendMemberName) {
|
if (member && member.cardName !== msg.sendMemberName) {
|
||||||
@ -327,7 +328,7 @@ export class OB11Constructor {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const element of msg.elements) {
|
for (const element of msg.elements) {
|
||||||
const grayTipElement = element.grayTipElement;
|
const grayTipElement = element.grayTipElement;
|
||||||
const groupElement = grayTipElement?.groupElement;
|
const groupElement = grayTipElement?.groupElement;
|
||||||
@ -494,13 +495,16 @@ export class OB11Constructor {
|
|||||||
chatType: ChatType.group,
|
chatType: ChatType.group,
|
||||||
peerUid: Group!
|
peerUid: Group!
|
||||||
};
|
};
|
||||||
|
return new OB11GroupEssenceEvent(parseInt(msg.peerUid), msg.id!);
|
||||||
// 获取MsgSeq+Peer可获取具体消息
|
// 获取MsgSeq+Peer可获取具体消息
|
||||||
}
|
}
|
||||||
//下面得改 上面也是错的grayTipElement.subElementType == GrayTipElementSubType.MEMBER_NEW_TITLE
|
if (grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
||||||
const memberUin = json.items[1].param[0];
|
//下面得改 上面也是错的grayTipElement.subElementType == GrayTipElementSubType.MEMBER_NEW_TITLE
|
||||||
const title = json.items[3].txt;
|
const memberUin = json.items[1].param[0];
|
||||||
logDebug('收到群成员新头衔消息', json);
|
const title = json.items[3].txt;
|
||||||
return new OB11GroupTitleEvent(parseInt(msg.peerUid), parseInt(memberUin), title);
|
logDebug('收到群成员新头衔消息', json);
|
||||||
|
return new OB11GroupTitleEvent(parseInt(msg.peerUid), parseInt(memberUin), title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
src/onebot11/event/notice/OB11GroupEssenceEvent.ts
Normal file
11
src/onebot11/event/notice/OB11GroupEssenceEvent.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||||
|
export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent {
|
||||||
|
notice_type = 'group_essence';
|
||||||
|
message_id: number;
|
||||||
|
|
||||||
|
constructor(groupId: number, message_id: number) {
|
||||||
|
super();
|
||||||
|
this.group_id = groupId;
|
||||||
|
this.message_id = message_id;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user