perf: 引用原图逻辑判断

This commit is contained in:
等风来 2024-08-08 13:40:57 +08:00 committed by 时雨◎星空
parent a3f8894129
commit 92875b5f31

View File

@ -15,16 +15,16 @@ export async function getOriginalPicture (e) {
if (e.source.user_id !== e.self_id) { if (e.source.user_id !== e.self_id) {
return false return false
} }
// 引用的消息不是纯图片
if (!/^\[图片]$/.test(e.source.message)) {
return false
}
// 获取原消息 // 获取原消息
if (e.group?.getChatHistory) { if (e.group?.getChatHistory) {
source = (await e.group.getChatHistory(e.source.seq, 1)).pop() source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
} else if (e.friend?.getChatHistory) { } else if (e.friend?.getChatHistory) {
source = (await e.friend.getChatHistory(e.source.time, 1)).pop() source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
} }
// 引用的不是纯图片
if (!(source?.message?.length === 1 && source?.message[0]?.type === 'image')) {
return false
}
} }
let originalPic = Cfg.get('originalPic') * 1 let originalPic = Cfg.get('originalPic') * 1
if (source) { if (source) {