From d3c6a0048b55a103b30e9e76729bf4085f9c5736 Mon Sep 17 00:00:00 2001 From: ningmengchongshui <916415899@qq.com> Date: Wed, 12 Jun 2024 21:25:21 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BC=98=E5=8C=96=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/plugins/index.ts | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/core/plugins/index.ts b/src/core/plugins/index.ts index d74f700..9f7cf20 100644 --- a/src/core/plugins/index.ts +++ b/src/core/plugins/index.ts @@ -84,22 +84,25 @@ export class Plugin { * @param priority 优先级,数字越小优先级越高 * @param rule 优先级,数字越小优先级越高 */ - constructor({ - event, - priority = 5000, - rule, - name, - dsc, - handler, - namespace, - task, - }: PluginSuperType) { + constructor(init?: PluginSuperType) { + const { + event, + priority = 5000, + rule, + name, + dsc, + handler, + namespace, + task, + } = init name && (this.name = name) dsc && (this.dsc = dsc) event && (this.event = event) priority && (this.priority = priority) - /** 定时任务,可以是数组 */ + /** + * 定时任务,可以是数组 + */ task && (this.task = { /** 任务名 */ @@ -110,7 +113,9 @@ export class Plugin { cron: task?.cron ?? '' }) - /** 命令规则 */ + /** + * 命令规则 + */ rule && (this.rule = rule) if (handler) {