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

Function readScheduleConfig

cy/cy.ts:103–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101 return Math.max(50, Math.min(MAX_LIMIT, Math.floor(num)));
102}
103
104function readScheduleConfig(): CyScheduleConfig {
105 try {
106 if (!fs.existsSync(CONFIG_PATH)) return { ...DEFAULT_SCHEDULE };
107 const raw = JSON.parse(fs.readFileSync(CONFIG_PATH, "utf8"));
108 return {
109 enabled: Boolean(raw.enabled),
110 target: typeof raw.target === "string" ? raw.target.trim() : "",
111 times: Array.isArray(raw.times) ? raw.times.map(String).filter(isValidTime).slice(0, 12) : [],
112 limit: normalizeLimit(raw.limit),
113 };
114 } catch {
115 return { ...DEFAULT_SCHEDULE };
116 }
117}
118
119function writeScheduleConfig(config: CyScheduleConfig): void {

Callers 2

tickScheduleMethod · 0.85
CyPluginClass · 0.85

Calls 1

normalizeLimitFunction · 0.85

Tested by

no test coverage detected