From 7bb1fd71a4797180574c0fdabcabf83c712ccdf2 Mon Sep 17 00:00:00 2001 From: yysforget <1121504223@qq.com> Date: Wed, 31 Jul 2024 17:55:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=94=BB=E7=95=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/guide.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/guide.js b/apps/guide.js index e9678ce..0c826e8 100644 --- a/apps/guide.js +++ b/apps/guide.js @@ -106,7 +106,7 @@ export class Guide extends ZZZPlugin { group = _.get(settings.getConfig('guide'), 'default_guide', 1).toString(), ] = this.e.msg.match(reg); // all -> 0 - if (group == 'all') { + if (group === 'all') { group = '0'; } group = Number(group); @@ -128,15 +128,23 @@ export class Guide extends ZZZPlugin { // msg.push(segment.image(`file://${guidePath}`)); if (guidePath) { msg.push(segment.image(guidePath)); + } else { + msg.push(`暂无${name}攻略 (${this.source[i - 1]})`) } } if (msg.length) { - await this.reply(await common.makeForwardMsg(this.e, [msg])); + await this.reply(await common.makeForwardMsg(this.e, msg)); } return false; } const guidePath = await this.getGuidePath(group, name, !!isUpdate); + if (!guidePath) { + this.e.reply( + `暂无${name}攻略 (${this.source[group - 1]})\n请尝试其他的攻略来源查询` + ); + return false; + } await this.e.reply(segment.image(guidePath)); return false; } @@ -182,9 +190,6 @@ export class Guide extends ZZZPlugin { } } if (!url) { - this.e.reply( - `暂无${name}攻略 (${this.source[group - 1]})\n请尝试其他的攻略来源查询` - ); return false; } logger.debug(