dankgrinder 8.77.0 → 8.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/grinder.js CHANGED
@@ -744,8 +744,10 @@ class AccountWorker {
744
744
  const self = this;
745
745
  function cleanup() {
746
746
  clearTimeout(timer);
747
- self.client.removeListener('messageCreate', handler);
748
- self.client.removeListener('messageUpdate', updateHandler);
747
+ if (self.client) {
748
+ self.client.removeListener('messageCreate', handler);
749
+ self.client.removeListener('messageUpdate', updateHandler);
750
+ }
749
751
  }
750
752
  function handler(msg) {
751
753
  if (msg.author.id === DANK_MEMER_ID && msg.channel.id === self.channel.id) {
@@ -3060,7 +3062,7 @@ async function start(apiKey, apiUrl, opts = {}) {
3060
3062
 
3061
3063
  const memFinal = Math.round((process.memoryUsage?.rss?.() ?? process.memoryUsage().rss) / 1048576);
3062
3064
  const cpm = globalCmdRate.getRate().toFixed(1);
3063
- console.log(`${c.bold}Total:${c.reset} +⏣${finalCoins.toLocaleString()} in ${formatUptime()} | ${finalCmds}cmds | ~${cpm}cmd/m | ${memFinal}MB`);
3065
+ console.log(`${c.bold}Total:${c.reset} +⏣${finalCoins.toLocaleString()} in ${ui.formatUptime()} | ${finalCmds}cmds | ~${cpm}cmd/m | ${memFinal}MB`);
3064
3066
 
3065
3067
  // Stop workers immediately (don't wait) — instant shutdown
3066
3068
  for (const wk of workers) {
@@ -3084,12 +3086,13 @@ async function start(apiKey, apiUrl, opts = {}) {
3084
3086
  console.log(` ${c.dim}${totalRecoveries} recoveries, ${totalDisconnects} disconnects, ${totalRateLimits} rate-limits${c.reset}`);
3085
3087
  }
3086
3088
 
3087
- const webhookMsg = `+⏣ ${finalCoins.toLocaleString()} | ${finalCmds} cmds | ${formatUptime()}` +
3089
+ const webhookMsg = `+⏣ ${finalCoins.toLocaleString()} | ${finalCmds} cmds | ${ui.formatUptime()}` +
3088
3090
  (totalRecoveries > 0 ? ` | ${totalRecoveries} auto-recoveries` : '') +
3089
3091
  (CLUSTER_ENABLED ? ` | node: ${NODE_ID.substring(0, 12)}` : '');
3090
3092
  sendWebhook('Session Ended', webhookMsg, 0x8b5cf6).catch(() => {});
3091
3093
 
3092
- if (redis) { redis.disconnect().catch(() => {}); }
3094
+ const disResult = redis?.disconnect?.();
3095
+ if (disResult && typeof disResult.catch === 'function') disResult.catch(() => {});
3093
3096
  console.log(`${c.green}Goodbye!${c.reset}\n`);
3094
3097
  // Force exit so Ctrl+C always terminates immediately
3095
3098
  setTimeout(() => process.exit(0), 2000);
package/lib/ui.js CHANGED
@@ -223,4 +223,4 @@ function startRefresh() { if (!_refreshTimer) _refreshTimer = setInterval(() =>
223
223
  function stopRefresh() { if (_refreshTimer) { clearInterval(_refreshTimer); _refreshTimer = null; } }
224
224
  function stop() { _live = false; stopRefresh(); logUpdate.clear(); }
225
225
 
226
- module.exports = { init, drawBanner, start, draw, log, logGlobal, stop, setLive, setPhase, updateAccountRow, startRefresh, stopRefresh, addEvent };
226
+ module.exports = { init, drawBanner, start, draw, log, logGlobal, stop, setLive, setPhase, updateAccountRow, startRefresh, stopRefresh, addEvent, formatUptime: fmtUptime };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dankgrinder",
3
- "version": "8.77.0",
3
+ "version": "8.79.0",
4
4
  "description": "Dank Memer automation engine — grind coins while you sleep",
5
5
  "bin": {
6
6
  "dankgrinder": "bin/dankgrinder.js"