mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 05:05:44 +08:00
Add peerUid validation in AT message handler
Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
This commit is contained in:
parent
374441e880
commit
51fcc587d1
@ -580,6 +580,11 @@ export class OneBotMsgApi {
|
|||||||
|
|
||||||
if (!context.peer || context.peer.chatType == ChatType.KCHATTYPEC2C) return undefined;
|
if (!context.peer || context.peer.chatType == ChatType.KCHATTYPEC2C) return undefined;
|
||||||
if (atQQ === 'all') return at(atQQ, atQQ, NTMsgAtType.ATTYPEALL, '全体成员');
|
if (atQQ === 'all') return at(atQQ, atQQ, NTMsgAtType.ATTYPEALL, '全体成员');
|
||||||
|
// 检查 peerUid 是否有效
|
||||||
|
if (!context.peer.peerUid) {
|
||||||
|
this.core.context.logger.logWarn('AT消息处理:群组 peerUid 无效', { atQQ });
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
const atMember = await this.core.apis.GroupApi.getGroupMember(context.peer.peerUid, atQQ);
|
const atMember = await this.core.apis.GroupApi.getGroupMember(context.peer.peerUid, atQQ);
|
||||||
if (atMember) {
|
if (atMember) {
|
||||||
return at(atQQ, atMember.uid, NTMsgAtType.ATTYPEONE, atMember.nick || atMember.cardName);
|
return at(atQQ, atMember.uid, NTMsgAtType.ATTYPEONE, atMember.nick || atMember.cardName);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user