From e1a5094232e4d4292d9f9697701fbc3fcb8545c0 Mon Sep 17 00:00:00 2001 From: Peagger <103034147+Peagger@users.noreply.github.com> Date: Tue, 13 Sep 2022 03:17:54 +0800 Subject: [PATCH] Update character-img-upload.js (#174) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加对at图片进行添加的支持 --- apps/character/character-img-upload.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/character/character-img-upload.js b/apps/character/character-img-upload.js index cbc1dc98..458cc1cb 100644 --- a/apps/character/character-img-upload.js +++ b/apps/character/character-img-upload.js @@ -42,8 +42,22 @@ export async function uploadCharacterImg (e) { 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) { - // TODO 支持at图片添加,以及支持后发送 + e.reply('消息中未找到图片,请将要发送的图片与消息一同发送..') return true }