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

Function parseTimeString

portball/portball.ts:18–33  ·  view source on GitHub ↗
(timeStr: string)

Source from the content-addressed store, hash-verified

16 if (!match) return -1;
17
18 const value = parseInt(match[1]);
19 const unit = match[2]?.toLowerCase() || 's';
20
21 const multipliers: Record<string, number> = {
22 's': 1,
23 'm': 60,
24 'h': 3600,
25 'd': 86400
26 };
27
28 return value * (multipliers[unit] || 1);
29};
30
31// Timer tracking for safe cleanup
32const pendingTimers = new Set<ReturnType<typeof setTimeout>>();
33
34function scheduleTimer(fn: () => void, ms: number): ReturnType<typeof setTimeout> {
35 const t = setTimeout(() => {
36 pendingTimers.delete(t);

Callers 1

handlePortballMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected