fix:增加兼容性

This commit is contained in:
ningmengchongshui 2024-06-17 11:10:00 +08:00
parent 3aba8f7280
commit dacfbabef9
1 changed files with 12 additions and 17 deletions

View File

@ -589,18 +589,16 @@ class PluginsLoader {
// 存在 // 存在
if (e.sender) { if (e.sender) {
// nickname e.sender.card = e.sender?.nickname
e.sender.card = e.sender.nickname
} else { } else {
e.sender = {} as any
// 不存在 // 不存在
e.sender = { e.sender = {
// nickname
card: e.friend?.nickname, card: e.friend?.nickname,
// nickname
nickname: e.friend?.nickname nickname: e.friend?.nickname
} as any } as any
} }
e.logText = `[私聊][${e.sender.nickname}(${e.user_id})]` e.logText = `[私聊][${e.sender?.nickname}(${e.user_id})]`
} }
/** /**
@ -612,22 +610,19 @@ class PluginsLoader {
// 存在 // 存在
if (e.sender) { if (e.sender) {
// nickname e.sender.card = e.sender.card ?? e.sender?.nickname
e.sender.card = e.sender.card ?? e.sender.nickname
} else if (e.member) { } else if (e.member) {
e.sender = { e.sender = {
// nickname card: e.member.card ?? e.member?.nickname,
card: e.member.card ?? e.member.nickname, nickname: e.member.card ?? e.member?.nickname
nickname: e.member.card ?? e.member.nickname
} as any } as any
} else if (e.nickname) { } else if (e?.nickname) {
e.sender = { e.sender = {
// nickname card: e?.nickname,
card: e.nickname, nickname: e?.nickname
// nickname
nickname: e.nickname
} as any } as any
} else { } else {
e.sender = {} as any
e.sender = { e.sender = {
card: e?.user_id ?? '', card: e?.user_id ?? '',
nickname: e?.user_id ?? '' nickname: e?.user_id ?? ''
@ -653,8 +648,8 @@ class PluginsLoader {
if (e?.group_id) { if (e?.group_id) {
e.group_avatar = `https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/640/` e.group_avatar = `https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/640/`
} }
if (e.sender.nickname) { if (e.sender?.nickname) {
e.user_name = e.sender.nickname e.user_name = e.sender?.nickname
} }
/** /**