Add peerUid validation in AT message handler

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-10-02 01:30:31 +00:00
parent 374441e880
commit 51fcc587d1

View File

@ -580,6 +580,11 @@ export class OneBotMsgApi {
if (!context.peer || context.peer.chatType == ChatType.KCHATTYPEC2C) return undefined;
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);
if (atMember) {
return at(atQQ, atMember.uid, NTMsgAtType.ATTYPEONE, atMember.nick || atMember.cardName);