MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / checkAndRun

Method checkAndRun

checkin/checkin.ts:322–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

320 if (conf.runTimeEnd) {
321 const [startH, startM] = value.split(":").map(Number);
322 const [endH, endM] = conf.runTimeEnd.split(":").map(Number);
323 if (startH * 60 + startM > endH * 60 + endM && endH * 60 + endM > 0) {
324 await this.edit(msg, `⚠️ 开始时间 (${value}) 晚于结束时间 (${conf.runTimeEnd}),请调整时间范围`);
325 return;
326 }
327 }
328
329 this.cfg.save({ runTime: value });
330 await this.edit(msg, `✅ 开始时间已设置为: ${value}`);
331 return;
332 }
333
334 if (type === "range" || type === "r") {
335 if (!value) {
336 this.cfg.save({ runTimeEnd: undefined });
337 await this.edit(msg, "✅ 已清除执行时间范围,改为固定时间执行");
338 return;
339 }
340
341 if (!/^([01]?\d|2[0-3]):[0-5]\d$/.test(value)) {
342 await this.edit(msg, "❌ 格式错误,请使用 HH:MM (例如 11:30)");
343 return;
344 }
345
346 const [startH, startM] = conf.runTime.split(":").map(Number);
347 const [endH, endM] = value.split(":").map(Number);
348 if (startH * 60 + startM > endH * 60 + endM && endH * 60 + endM > 0) {
349 await this.edit(msg, `⚠️ 开始时间 (${conf.runTime}) 晚于结束时间 (${value}),将允许跨天执行`);
350 }
351
352 this.cfg.save({ runTimeEnd: value });
353 await this.edit(msg, `✅ 执行时间范围已设置为: ${conf.runTime} ~ ${value}(将在该时间段内随机执行)`);
354 return;
355 }
356
357 if (type === "delay" || type === "d") {
358 const n = Number(value);
359 if (!Number.isInteger(n) || n < 0 || n > 60) {
360 await this.edit(msg, "❌ 请输入 0-60 之间的分钟数");
361 return;
362 }
363 this.cfg.save({ randomDelay: n });
364 await this.edit(msg, `✅ 随机延迟已设置为: ${n} 分钟`);
365 return;
366 }
367

Callers 1

constructorMethod · 0.95

Calls 7

dateCNMethod · 0.95
getTodayRunTimeMethod · 0.95
sleepMethod · 0.95
runAllSignsMethod · 0.95
saveMethod · 0.80
errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected