fix: 优化解析

This commit is contained in:
ningmengchongshui 2024-06-09 23:19:06 +08:00
parent 068b0e60b7
commit 0602eb0041
2 changed files with 18 additions and 18 deletions

View File

@ -7,27 +7,27 @@ class ListenerLoader {
client = null client = null
/** /**
* *
* @param listener * @param listener
* @param File * @param File
* @returns * @returns
*/ */
init = (listener, File: string) => { init = (listener, File: string) => {
try { try {
if (!listener.default) return if (!listener.default) return
/** /**
* *
*/ */
listener = new listener.default() listener = new listener.default()
/** /**
* *
*/ */
listener.client = this.client listener.client = this.client
/** /**
* *
*/ */
const on = listener.once ? 'once' : 'on' const on = listener.once ? 'once' : 'on'
@ -68,7 +68,6 @@ class ListenerLoader {
this.init(await import('./events/offline.js'), './events/offline.js') this.init(await import('./events/offline.js'), './events/offline.js')
this.init(await import('./events/online.js'), './events/online.js') this.init(await import('./events/online.js'), './events/online.js')
this.init(await import('./events/request.js'), './events/request.js') this.init(await import('./events/request.js'), './events/request.js')
} }
} }

View File

@ -66,16 +66,17 @@ export class plugin {
dsc && (this.dsc = dsc) dsc && (this.dsc = dsc)
event && (this.event = event) event && (this.event = event)
priority && (this.priority = priority) priority && (this.priority = priority)
/** 定时任务,可以是数组 */ /** 定时任务,可以是数组 */
task && (this.task = { task &&
/** 任务名 */ (this.task = {
name: task?.name ?? '', /** 任务名 */
/** 任务方法名 */ name: task?.name ?? '',
fnc: task?.fnc ?? '', /** 任务方法名 */
/** 任务cron表达式 */ fnc: task?.fnc ?? '',
cron: task?.cron ?? '' /** 任务cron表达式 */
}) cron: task?.cron ?? ''
})
/** 命令规则 */ /** 命令规则 */
rule && (this.rule = rule) rule && (this.rule = rule)