koishi-plugin-schedule
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -29,3 +29,3 @@ "use strict"; | ||
return; | ||
session.$app.execute(command, session); | ||
session.$execute(command); | ||
database.removeSchedule(id); | ||
@@ -41,5 +41,5 @@ }, date - now); | ||
return clearInterval(timer); | ||
session.$app.execute(command, session); | ||
session.$execute(command); | ||
}, interval); | ||
session.$app.execute(command, session); | ||
session.$execute(command); | ||
}, timeout); | ||
@@ -74,3 +74,3 @@ } | ||
await database.removeSchedule(options.delete); | ||
return session.$send(`日程 ${options.delete} 已删除。`); | ||
return `日程 ${options.delete} 已删除。`; | ||
} | ||
@@ -83,4 +83,4 @@ if (options.list || options.fullList) { | ||
if (!schedules.length) | ||
return session.$send('当前没有等待执行的日程。'); | ||
return session.$send(schedules.map(({ id, time, interval, command, session }) => { | ||
return '当前没有等待执行的日程。'; | ||
return schedules.map(({ id, time, interval, command, session }) => { | ||
let output = `${id}. 触发时间:${koishi_utils_1.formatTimeInterval(time, interval)},指令:${command}`; | ||
@@ -90,16 +90,16 @@ if (options.fullList) | ||
return output; | ||
}).join('\n')); | ||
}).join('\n'); | ||
} | ||
if (!options.rest) | ||
return session.$send('请输入要执行的指令。'); | ||
return '请输入要执行的指令。'; | ||
const time = koishi_utils_1.parseDate(dateSegments.join('-')); | ||
if (Number.isNaN(+time)) { | ||
return session.$send('请输入合法的日期。'); | ||
return '请输入合法的日期。'; | ||
} | ||
else if (!options.interval && +time <= Date.now()) { | ||
return session.$send('不能指定过去的时间为起始时间。'); | ||
return '不能指定过去的时间为起始时间。'; | ||
} | ||
const interval = koishi_utils_1.parseTime(options.interval); | ||
if (!interval && options.interval) { | ||
return session.$send('请输入合法的时间间隔。'); | ||
return '请输入合法的时间间隔。'; | ||
} | ||
@@ -106,0 +106,0 @@ const schedule = await database.createSchedule(time, interval, options.rest, session); |
{ | ||
"name": "koishi-plugin-schedule", | ||
"description": "Schedule plugin for Koishi", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"main": "dist/index.js", | ||
@@ -41,5 +41,5 @@ "typings": "dist/index.d.ts", | ||
"dependencies": { | ||
"koishi-core": "^2.0.0-beta.2", | ||
"koishi-core": "^2.0.0-beta.3", | ||
"koishi-utils": "^2.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
12731
Updatedkoishi-core@^2.0.0-beta.3