Skip to content

Commit 92b9d80

Browse files
committed
fix: handle undefined adminUid in group admin change event
1 parent 6f29944 commit 92b9d80

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/onebot11/adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ class OneBot11Adapter extends Service {
366366
} else if (msgType === 44) {
367367
const tip = Notify.GroupAdmin.decode(sysMsg.body.msgContent)
368368
this.ctx.logger.info('收到管理员变动通知', tip)
369-
const uin = await this.ctx.ntUserApi.getUinByUid(tip.isPromote ? tip.body.extraEnable!.adminUid : tip.body.extraDisable!.adminUid)
369+
const uid = tip.isPromote ? tip.body.extraEnable?.adminUid : tip.body.extraDisable?.adminUid
370+
if (!uid) return null
371+
const uin = await this.ctx.ntUserApi.getUinByUid(uid)
370372
const event = new OB11GroupAdminNoticeEvent(
371373
tip.isPromote ? 'set' : 'unset',
372374
tip.groupCode,

0 commit comments

Comments
 (0)