From b16d55a2a7efbd9ef2fd0e2ca5c8a8f6f33f7d33 Mon Sep 17 00:00:00 2001 From: ren Date: Mon, 16 Feb 2026 19:45:25 -0300 Subject: [PATCH] Use nextResetTime for GLM remaining time --- dist/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index d590881..c26440a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -84,10 +84,20 @@ async function getGlmUsage() { let totalMinutes = 0; for (const l of limits) { - if (l.type === 'TOKENS_LIMIT') tokenPct = l.percentage || 0; + if (l.type === 'TOKENS_LIMIT') { + tokenPct = l.percentage || 0; + if (l.nextResetTime) { + const resetDate = new Date(l.nextResetTime); + const now = new Date(); + timeRemaining = (resetDate - now) / 1000 / 60; + } + } if (l.type === 'TIME_LIMIT') { - timeRemaining = (l.remaining || 0) / 1000 / 60; - totalMinutes = (l.total || 0) / 1000 / 60; + if (l.nextResetTime && timeRemaining === 0) { + const resetDate = new Date(l.nextResetTime); + const now = new Date(); + timeRemaining = (resetDate - now) / 1000 / 60; + } } }