From b44c9caa47f7b0371db83c174b3fed59690706e1 Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Wed, 31 Jul 2024 19:33:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=83=A8=E5=88=86=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/guide.js | 48 ------------------------------------------------ apps/manage.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/apps/guide.js b/apps/guide.js index 2af03dc..d5b0831 100644 --- a/apps/guide.js +++ b/apps/guide.js @@ -25,14 +25,6 @@ export class Guide extends ZZZPlugin { reg: `^${rulePrefix}攻略(说明|帮助)$`, fnc: 'GuideHelp', }, - { - reg: `^${rulePrefix}设置默认攻略(\\d+|all)$`, - fnc: 'SetDefaultGuide', - }, - { - reg: `^${rulePrefix}设置所有攻略显示个数(\\d+)$`, - fnc: 'SetMaxForwardGuide', - }, { reg: `${rulePrefix}(更新)?\\S+攻略(\\d+|all)?$`, fnc: 'Guide', @@ -221,44 +213,4 @@ export class Guide extends ZZZPlugin { ].concat(this.source.map((element, index) => `${index + 1}: ${element}`)); await this.e.reply(reply_msg.join('\n')); } - - /** %设置默认攻略1 */ - async SetDefaultGuide() { - if (!this.e.isMaster) { - this.reply('仅限主人设置'); - return false; - } - let match = /设置默认攻略(\d+|all)$/g.exec(this.e.msg); - let guide_id = match[1]; - if (guide_id == 'all') { - guide_id = 0; - } - guide_id = Number(guide_id); - if (guide_id > this.maxNum) { - let reply_msg = [ - '绝区零默认攻略设置方式为:', - '%设置默认攻略[0123...]', - `请增加数字0-${this.maxNum}其中一个,或者增加 all 以显示所有攻略`, - '攻略来源请输入 %攻略帮助 查看', - ]; - await this.e.reply(reply_msg.join('\n')); - return; - } - settings.setSingleConfig('guide', 'default_guide', guide_id); - - let source_name = guide_id == 0 ? 'all' : this.source[guide_id - 1]; - await this.e.reply(`绝区零默认攻略已设置为: ${guide_id} (${source_name})`); - } - - /** %设置所有攻略显示个数3 */ - async SetMaxForwardGuide() { - if (!this.e.isMaster) { - this.reply('仅限主人设置'); - return false; - } - let match = /设置所有攻略显示个数(\d+)$/g.exec(this.e.msg); - let max_forward_guide = Number(match[1]); - this.setSingleConfig('max_forward_guides', max_forward_guide); - await this.e.reply(`绝区零所有攻略显示个数已设置为: ${max_forward_guide}`); - } } diff --git a/apps/manage.js b/apps/manage.js index 1a2c300..a57ccca 100644 --- a/apps/manage.js +++ b/apps/manage.js @@ -30,6 +30,14 @@ export class Panel extends ZZZPlugin { reg: `${rulePrefix}删除(全部|所有)资源$`, fnc: 'deleteAll', }, + { + reg: `^${rulePrefix}设置默认攻略(\\d+|all)$`, + fnc: 'setDefaultGuide', + }, + { + reg: `^${rulePrefix}设置所有攻略显示个数(\\d+)$`, + fnc: 'setMaxForwardGuide', + }, ], }); } @@ -138,4 +146,44 @@ export class Panel extends ZZZPlugin { } await this.reply('资源图片已删除!'); } + + /** 设置默认攻略 */ + async setDefaultGuide() { + if (!this.e.isMaster) { + this.reply('仅限主人设置'); + return false; + } + let match = /设置默认攻略(\d+|all)$/g.exec(this.e.msg); + let guide_id = match[1]; + if (guide_id == 'all') { + guide_id = 0; + } + guide_id = Number(guide_id); + if (guide_id > this.maxNum) { + let reply_msg = [ + '绝区零默认攻略设置方式为:', + '%设置默认攻略[0123...]', + `请增加数字0-${this.maxNum}其中一个,或者增加 all 以显示所有攻略`, + '攻略来源请输入 %攻略帮助 查看', + ]; + await this.e.reply(reply_msg.join('\n')); + return; + } + settings.setSingleConfig('guide', 'default_guide', guide_id); + + let source_name = guide_id == 0 ? 'all' : this.source[guide_id - 1]; + await this.e.reply(`绝区零默认攻略已设置为: ${guide_id} (${source_name})`); + } + + /** 设置所有攻略显示个数 */ + async setMaxForwardGuide() { + if (!this.e.isMaster) { + this.reply('仅限主人设置'); + return false; + } + let match = /设置所有攻略显示个数(\d+)$/g.exec(this.e.msg); + let max_forward_guide = Number(match[1]); + this.setSingleConfig('max_forward_guides', max_forward_guide); + await this.e.reply(`绝区零所有攻略显示个数已设置为: ${max_forward_guide}`); + } }