diff --git a/lib/plugins/plugin.js b/lib/plugins/plugin.js index 35619e2..1a7616e 100644 --- a/lib/plugins/plugin.js +++ b/lib/plugins/plugin.js @@ -17,27 +17,26 @@ export default class plugin { * @param task.fnc 定时任务方法名 * @param task.log false时不显示执行日志 */ - constructor (data) { + constructor({ name = 'your-plugin', dsc = '无', event = 'message', priority = 5000, task = { fnc: '', cron: '' }, rule = [] }) { /** 插件名称 */ - this.name = data.name + this.name = name /** 插件描述 */ - this.dsc = data.dsc + this.dsc = dsc /** 监听事件,默认message https://oicqjs.github.io/oicq/#events */ - this.event = data.event || 'message' + this.event = event /** 优先级 */ - this.priority = data.priority || 5000 + this.priority = priority /** 定时任务,可以是数组 */ this.task = { /** 任务名 */ name: '', /** 任务方法名 */ - fnc: data.task?.fnc || '', + fnc: task.fnc || '', /** 任务cron表达式 */ - cron: data.task?.cron || '' + cron: task.cron || '' } - /** 命令规则 */ - this.rule = data.rule || [] + this.rule = rule } /**