update: 优化插件参数

This commit is contained in:
ningmengchongshui 2024-06-12 21:25:21 +08:00
parent 1c2d1757b3
commit d3c6a0048b
1 changed files with 17 additions and 12 deletions

View File

@ -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) {