New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koishi-plugin-schedule

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koishi-plugin-schedule - npm Package Compare versions

Comparing version 4.4.4 to 5.0.0

4

lib/index.d.ts

@@ -1,2 +0,2 @@

import { Computed, Context, Schema, Session } from 'koishi';
import { Computed, Context, Schema, Universal } from 'koishi';
declare module 'koishi' {

@@ -14,3 +14,3 @@ interface Tables {

command: string;
session: Session.Payload;
event: Universal.Event;
}

@@ -17,0 +17,0 @@ export declare const name = "schedule";

@@ -26,3 +26,3 @@ var __defProp = Object.defineProperty;

"external/common/packages/schedule/src/locales/zh-CN.yml"(exports, module2) {
module2.exports = { general: { days: ["日", "一", "二", "三", "四", "五", "六"], everyday: "每天 {0}", everyweek: "每周{0} {1}", interval: "每隔 <i18n:time value={0}/> (剩余 <i18n:time value={1}/>)" }, commands: { schedule: { description: "设置定时命令", options: { rest: "要执行的指令", interval: "设置触发的间隔秒数", list: "查看已经设置的日程", ensure: "错过时间也确保执行", full: "查找全部上下文", delete: "删除已经设置的日程" }, messages: { context: ",上下文:{0}", "context.private": "私聊 {userId}", "context.guild": "频道 {channelId}", "delete-success": "日程 {0} 已删除。", "create-success": "日程已创建,编号为 {0}。", "list-empty": "当前没有等待执行的日程。", "command-expected": "请输入要执行的指令。", "date-invalid": "请输入合法的日期。", "date-invalid-suggestion": "请输入合法的日期。你要输入的是不是 {0}s?", "date-expected": "请输入执行时间。", "date-past": "不能指定过去的时间为执行时间。", "interval-invalid": "请输入合法的时间间隔。", "interval-too-short": "时间间隔过短。" } } } };
module2.exports = { general: { days: ["日", "一", "二", "三", "四", "五", "六"], everyday: "每天 {0}", everyweek: "每周{0} {1}", interval: "每隔 <i18n:time value={0}/> (剩余 <i18n:time value={1}/>)" }, commands: { schedule: { description: "设置定时命令", options: { rest: "要执行的指令", interval: "设置触发的间隔秒数", list: "查看已经设置的日程", ensure: "错过时间也确保执行", full: "查找全部上下文", delete: "删除已经设置的日程" }, messages: { context: ",上下文:{0}", "context.private": "私聊 {user.id}", "context.guild": "频道 {channel.id}", "delete-success": "日程 {0} 已删除。", "create-success": "日程已创建,编号为 {0}。", "list-empty": "当前没有等待执行的日程。", "command-expected": "请输入要执行的指令。", "date-invalid": "请输入合法的日期。", "date-invalid-suggestion": "请输入合法的日期。你要输入的是不是 {0}s?", "date-expected": "请输入执行时间。", "date-past": "不能指定过去的时间为执行时间。", "interval-invalid": "请输入合法的时间间隔。", "interval-too-short": "时间间隔过短。" } } } };
}

@@ -79,3 +79,3 @@ });

command: "text",
session: "json"
event: "json"
}, {

@@ -94,3 +94,7 @@ autoInc: true

logger.debug("execute %d: %c", id, command);
await session.execute(command);
try {
await session.execute(command);
} catch (error) {
logger.warn(error);
}
if (!lastCall || !interval)

@@ -122,3 +126,3 @@ return;

}
ctx.setTimeout(async () => {
return ctx.setTimeout(async () => {
if (!await hasSchedule(id))

@@ -139,6 +143,8 @@ return;

data.forEach((schedule) => {
const { session, assignee } = schedule;
const { event, assignee } = schedule;
if (!event)
return;
const bot = ctx.bots[assignee];
if (bot) {
prepareSchedule(schedule, new import_koishi.Session(bot, session));
prepareSchedule(schedule, bot.session(event));
} else {

@@ -149,3 +155,3 @@ (schedules[assignee] || (schedules[assignee] = [])).push(schedule);

ctx.on("bot-status-updated", (bot) => {
if (bot.status !== "online")
if (bot.status !== import_koishi.Universal.Status.ONLINE)
return;

@@ -157,7 +163,7 @@ const items = schedules[bot.sid];

items.forEach((schedule) => {
prepareSchedule(schedule, new import_koishi.Session(bot, schedule.session));
prepareSchedule(schedule, bot.session(schedule.event));
});
});
});
ctx.command("schedule [time]", { authority: 3, checkUnknown: true }).option("rest", "-- <command:text>").option("interval", "/ <interval:string>", { authority: 4 }).option("list", "-l").option("ensure", "-e").option("full", "-f", { authority: 4 }).option("delete", "-d <id>").action(async ({ session, options }, ...dateSegments) => {
ctx.command("schedule [time]", { authority: 3, checkUnknown: true }).option("rest", "-- <command:text>").option("interval", "/ <interval:string>", { authority: 4 }).option("list", "-l").option("ensure", "-e").option("full", "-f", { authority: 4 }).option("delete", "-d <id:number>").action(async ({ session, options }, ...dateSegments) => {
if (options.delete) {

@@ -169,11 +175,12 @@ await ctx.database.remove("schedule", [options.delete]);

let schedules = await ctx.database.get("schedule", { assignee: [session.sid] });
schedules = schedules.filter((s) => s.event);
if (!options.full) {
schedules = schedules.filter((s) => session.channelId === s.session.channelId);
schedules = schedules.filter((s) => session.channelId === s.event.channel.id);
}
if (!schedules.length)
return session.text(".list-empty");
return schedules.map(({ id, time: time2, interval: interval2, command, session: payload }) => {
return schedules.map(({ id, time: time2, interval: interval2, command, event }) => {
let output = `${id}. ${formatInterval(time2, interval2, session)}:${command}`;
if (options.full) {
output += session.text(".context", [payload.isDirect ? session.text(".context.private", payload) : session.text(".context.guild", payload)]);
output += session.text(".context", [event.channel.type === import_koishi.Universal.Channel.Type.DIRECT ? session.text(".context.private", event) : session.text(".context.guild", event)]);
}

@@ -212,3 +219,3 @@ return output;

command: options.rest,
session: JSON.parse(JSON.stringify(session))
event: session.event
});

@@ -215,0 +222,0 @@ prepareSchedule(schedule, session);

{
"name": "koishi-plugin-schedule",
"version": "4.4.4",
"version": "5.0.0",
"description": "Create scheduled tasks for Koishi",

@@ -48,10 +48,10 @@ "main": "lib/index.js",

"devDependencies": {
"@koishijs/plugin-database-memory": "^2.3.4",
"@koishijs/plugin-help": "^2.3.0",
"@koishijs/plugin-mock": "^2.5.0",
"koishi": "^4.14.3"
"@koishijs/plugin-database-memory": "^2.3.5",
"@koishijs/plugin-help": "^2.3.2",
"@koishijs/plugin-mock": "^2.6.0",
"koishi": "^4.15.0"
},
"peerDependencies": {
"koishi": "^4.14.3"
"koishi": "^4.15.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc