dankgrinder 7.6.0 → 7.11.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/bin/dankgrinder.js +2 -2
- package/lib/commands/farm.js +416 -86
- package/lib/commands/farmVision.js +190 -96
- package/lib/commands/utils.js +17 -3
- package/lib/grinder.js +77 -20
- package/lib/rawLogger.js +23 -2
- package/package.json +1 -1
package/lib/rawLogger.js
CHANGED
|
@@ -471,6 +471,19 @@ function verboseLog(event, parsed) {
|
|
|
471
471
|
const dmListeners = [];
|
|
472
472
|
function onDmEvent(fn) { dmListeners.push(fn); }
|
|
473
473
|
|
|
474
|
+
// ── Ephemeral message callbacks ──
|
|
475
|
+
const ephemeralListeners = [];
|
|
476
|
+
function onNextEphemeral(fn) { ephemeralListeners.push(fn); }
|
|
477
|
+
|
|
478
|
+
function _notifyEphemeral(parsed) {
|
|
479
|
+
if (!ephemeralListeners.length) return;
|
|
480
|
+
const listeners = [...ephemeralListeners];
|
|
481
|
+
ephemeralListeners.length = 0;
|
|
482
|
+
for (const fn of listeners) {
|
|
483
|
+
try { fn(parsed); } catch {}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
474
487
|
/**
|
|
475
488
|
* Attach DM logger — monitors Dank Memer DMs for:
|
|
476
489
|
* - Level ups: "You leveled up from level X to Y"
|
|
@@ -585,8 +598,15 @@ function attachRawLogger(client, opts = {}) {
|
|
|
585
598
|
|
|
586
599
|
const event = packet.t === 'MESSAGE_CREATE' ? 'CREATE' : 'UPDATE';
|
|
587
600
|
const parsed = store(d, event); // async but we don't await (fire-and-forget)
|
|
588
|
-
if (parsed.then)
|
|
589
|
-
|
|
601
|
+
if (parsed.then) {
|
|
602
|
+
parsed.then(p => {
|
|
603
|
+
verboseLog(event, p);
|
|
604
|
+
if (p?.isEphemeral) _notifyEphemeral(p);
|
|
605
|
+
}).catch(() => {});
|
|
606
|
+
} else {
|
|
607
|
+
verboseLog(event, parsed);
|
|
608
|
+
if (parsed?.isEphemeral) _notifyEphemeral(parsed);
|
|
609
|
+
}
|
|
590
610
|
});
|
|
591
611
|
}
|
|
592
612
|
|
|
@@ -673,6 +693,7 @@ module.exports = {
|
|
|
673
693
|
attachRawLogger,
|
|
674
694
|
attachDmLogger,
|
|
675
695
|
onDmEvent,
|
|
696
|
+
onNextEphemeral,
|
|
676
697
|
setVerbose,
|
|
677
698
|
// Memory reads
|
|
678
699
|
getRawMessage,
|