From 09a17faa405679bc8bcc6106df7c6b1346f64cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8C=8C?= Date: Sat, 1 Jun 2024 16:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=90=20=E7=BB=86=E8=8A=82=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assistant/other.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/assistant/other.js b/apps/assistant/other.js index ac70e97..63e9259 100644 --- a/apps/assistant/other.js +++ b/apps/assistant/other.js @@ -99,14 +99,15 @@ export class Assistant_Other extends plugin { } async imageOcr(e) { + const imageOcr = e.bot.imageOcr || Bot.imageOcr + if (!imageOcr) return this.reply("❎ 当前协议暂不支持OCR") const sourceImg = await common.takeSourceMsg(e, { img: true }) const img = sourceImg || e.img if (_.isEmpty(img)) { this.setContext("_imageOcrContext") - await this.reply("⚠ 请发送图片") - return + return this.reply("⚠ 请发送图片") } - let res = await e.bot.imageOcr(img[0]) + let res = await imageOcr(img[0]) let r = res.wordslist.map(i => i.words).join("\n") e.reply(r) return true @@ -116,13 +117,11 @@ export class Assistant_Other extends plugin { e.img = this.e.img if (this.e.msg === "取消") { this.finish("_imageOcrContext") - await this.reply("✅ 已取消") - return + return this.reply("✅ 已取消") } if (!e.img) { this.setContext("_imageOcrContext") - await this.reply("⚠ 请发送图片或取消") - return + return this.reply("⚠ 请发送图片或取消") } this.imageOcr(e) this.finish("_imageOcrContext")