Update character-img-upload.js (#174)

添加对at图片进行添加的支持
This commit is contained in:
Peagger 2022-09-13 03:17:54 +08:00 committed by GitHub
parent cecc16d574
commit e1a5094232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,8 +42,22 @@ export async function uploadCharacterImg (e) {
imageMessages.push(val) imageMessages.push(val)
} }
} }
let source
if (e.isGroup) {// 支持at图片添加以及支持后发送
source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
} else {
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
}
if (source) {
for (let val of source.message) {
if (val.type === 'image') {
imageMessages.push(val)
}
}
}
if (imageMessages.length <= 0) { if (imageMessages.length <= 0) {
// TODO 支持at图片添加以及支持后发送
e.reply('消息中未找到图片,请将要发送的图片与消息一同发送..') e.reply('消息中未找到图片,请将要发送的图片与消息一同发送..')
return true return true
} }