dankgrinder 8.113.0 β 8.343.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/commands/beg.js +1 -1
- package/lib/commands/crime.js +1 -1
- package/lib/commands/deposit.js +1 -1
- package/lib/commands/dig.js +1 -1
- package/lib/commands/drops.js +1 -1
- package/lib/commands/farm.js +1 -1
- package/lib/commands/fish.js +2 -2
- package/lib/commands/generic.js +2 -3
- package/lib/commands/highlow.js +1 -1
- package/lib/commands/hunt.js +1 -1
- package/lib/commands/inventory.js +1 -1
- package/lib/commands/postmemes.js +1 -1
- package/lib/commands/profile.js +1 -1
- package/lib/commands/scratch.js +1 -1
- package/lib/commands/search.js +1 -1
- package/lib/commands/stream.js +1 -1
- package/lib/commands/trivia.js +1 -1
- package/lib/commands/utils.js +6 -5
- package/lib/commands/work.js +1 -1
- package/lib/grinder.js +7 -7
- package/package.json +1 -1
package/lib/commands/beg.js
CHANGED
|
@@ -14,7 +14,7 @@ const RE_NEWLINE = /\n/g;
|
|
|
14
14
|
* @param {function} opts.waitForDankMemer
|
|
15
15
|
* @returns {Promise<{result: string, coins: number}>}
|
|
16
16
|
*/
|
|
17
|
-
async function runBeg({ channel, waitForDankMemer }) {
|
|
17
|
+
async function runBeg({ channel, waitForDankMemer, useSlash = false, prefix = 'pls' }) {
|
|
18
18
|
LOG.cmd(`${c.white}${c.bold}pls beg${c.reset}`);
|
|
19
19
|
|
|
20
20
|
await sendCommand(channel, 'beg', { useSlash, prefix });
|
package/lib/commands/crime.js
CHANGED
|
@@ -84,7 +84,7 @@ function pickSafeButton(buttons, customSafe) {
|
|
|
84
84
|
* @param {string[]} [opts.safeAnswers]
|
|
85
85
|
* @returns {Promise<{result: string, coins: number}>}
|
|
86
86
|
*/
|
|
87
|
-
async function runCrime({ channel, waitForDankMemer, safeAnswers }) {
|
|
87
|
+
async function runCrime({ channel, waitForDankMemer, safeAnswers, useSlash = false, prefix = 'pls' }) {
|
|
88
88
|
LOG.cmd(`${c.white}${c.bold}pls crime${c.reset}`);
|
|
89
89
|
|
|
90
90
|
await sendCommand(channel, 'crime', { useSlash, prefix });
|
package/lib/commands/deposit.js
CHANGED
|
@@ -14,7 +14,7 @@ sendCommand,
|
|
|
14
14
|
* @param {function} opts.waitForDankMemer
|
|
15
15
|
* @returns {Promise<{result: string, coins: number}>}
|
|
16
16
|
*/
|
|
17
|
-
async function runDeposit({ channel, waitForDankMemer }) {
|
|
17
|
+
async function runDeposit({ channel, waitForDankMemer, useSlash = false, prefix = 'pls' }) {
|
|
18
18
|
LOG.cmd(`${c.white}${c.bold}pls dep max${c.reset}`);
|
|
19
19
|
|
|
20
20
|
await sendCommand(channel, 'dep max', { useSlash, prefix });
|
package/lib/commands/dig.js
CHANGED
|
@@ -94,7 +94,7 @@ async function resolveDigFlow({ channel, waitForDankMemer, response }) {
|
|
|
94
94
|
* @param {object} [opts.client]
|
|
95
95
|
* @returns {Promise<{result: string, coins: number}>}
|
|
96
96
|
*/
|
|
97
|
-
async function runDig({ channel, waitForDankMemer, client }) {
|
|
97
|
+
async function runDig({ channel, waitForDankMemer, client, useSlash = false, prefix = 'pls' }) {
|
|
98
98
|
LOG.cmd(`${c.white}${c.bold}pls dig${c.reset}`);
|
|
99
99
|
|
|
100
100
|
await sendCommand(channel, 'dig', { useSlash, prefix });
|
package/lib/commands/drops.js
CHANGED
|
@@ -14,7 +14,7 @@ const RE_DROP_NAME_FALLBACK = /(\w[\w\s']+)/;
|
|
|
14
14
|
const RE_COST_LINE = /Cost:\s*[β£π°o]?\s*([\d,]+)/i;
|
|
15
15
|
const RE_WHITESPACE_UNDERSCORE = /\s+/g;
|
|
16
16
|
|
|
17
|
-
async function runDrops({ channel, waitForDankMemer, redis, accountId }) {
|
|
17
|
+
async function runDrops({ channel, waitForDankMemer, redis, accountId, useSlash = false, prefix = 'pls' }) {
|
|
18
18
|
LOG.cmd(`${c.white}${c.bold}pls drops${c.reset}`);
|
|
19
19
|
|
|
20
20
|
await sendCommand(channel, 'drops', { useSlash, prefix });
|
package/lib/commands/farm.js
CHANGED
|
@@ -1293,7 +1293,7 @@ async function advancePastConfirmation(response, waitForDankMemer) {
|
|
|
1293
1293
|
// ββ Single-cycle farm orchestrator ββββββββββββββββββββββββββββββββββββββββββ
|
|
1294
1294
|
// Sends `pls farm view` once, then completes the full hoeβwaterβplantβharvest
|
|
1295
1295
|
// cycle by looping on the returned manage menu β no additional command sends.
|
|
1296
|
-
async function runFarm({ channel, waitForDankMemer, client, redis, accountId, forceRun }) {
|
|
1296
|
+
async function runFarm({ channel, waitForDankMemer, client, redis, accountId, forceRun, useSlash = false, prefix = 'pls' }) {
|
|
1297
1297
|
LOG.cmd(`${c.white}${c.bold}pls farm view${c.reset}`);
|
|
1298
1298
|
|
|
1299
1299
|
await sendCommand(channel, 'farm view', { useSlash, prefix });
|
package/lib/commands/fish.js
CHANGED
|
@@ -303,7 +303,7 @@ async function playFishRound({ gameMsg, channel, msgId, waitForDankMemer }) {
|
|
|
303
303
|
* @param {function} opts.waitForDankMemer
|
|
304
304
|
* @returns {Promise<{result: string, coins: number, nextCooldownSec?: number}>}
|
|
305
305
|
*/
|
|
306
|
-
async function runFish({ channel, waitForDankMemer }) {
|
|
306
|
+
async function runFish({ channel, waitForDankMemer, useSlash = false, prefix = 'pls' }) {
|
|
307
307
|
LOG.cmd(`${c.white}${c.bold}pls fish catch${c.reset}`);
|
|
308
308
|
|
|
309
309
|
await sendCommand(channel, 'fish catch', { useSlash, prefix });
|
|
@@ -388,7 +388,7 @@ async function runFish({ channel, waitForDankMemer }) {
|
|
|
388
388
|
* @param {AbortSignal} [opts.signal] - Signal to stop early
|
|
389
389
|
* @returns {Promise<{totalRounds, totalCaught, totalMines, results: Array}>}
|
|
390
390
|
*/
|
|
391
|
-
async function runFishLoop({ channel, waitForDankMemer, maxRounds = 50, onRound, signal }) {
|
|
391
|
+
async function runFishLoop({ channel, waitForDankMemer, maxRounds = 50, onRound, signal, useSlash = false, prefix = 'pls' }) {
|
|
392
392
|
LOG.cmd(`${c.white}${c.bold}pls fish catch${c.reset} (loop mode, max ${maxRounds} rounds)`);
|
|
393
393
|
|
|
394
394
|
await sendCommand(channel, 'fish catch', { useSlash, prefix });
|
package/lib/commands/generic.js
CHANGED
|
@@ -50,10 +50,9 @@ async function waitForEditedMessage(channel, messageId, baselineText, timeoutMs
|
|
|
50
50
|
* @param {object} [opts.client]
|
|
51
51
|
* @returns {Promise<{result: string, coins: number}>}
|
|
52
52
|
*/
|
|
53
|
-
async function runGeneric({ channel, waitForDankMemer, cmdString, cmdName, client, useSlash, prefix = 'pls' }) {
|
|
53
|
+
async function runGeneric({ channel, waitForDankMemer, cmdString, cmdName, client, useSlash = false, prefix = 'pls' }) {
|
|
54
54
|
LOG.cmd(`${c.white}${c.bold}${cmdString}${c.reset}`);
|
|
55
|
-
//
|
|
56
|
-
// Build slash command: strip prefix β "farm view" β sendSlash('farm view')
|
|
55
|
+
// Strip prefix from cmdString to get just "command subcmd"
|
|
57
56
|
const slashName = cmdString
|
|
58
57
|
.replace(/^pls\s+/, '')
|
|
59
58
|
.replace(/^\/\s*/, '')
|
package/lib/commands/highlow.js
CHANGED
|
@@ -127,7 +127,7 @@ async function playHighLow(response, depth = 0) {
|
|
|
127
127
|
return { result: 'done', coins: 0 };
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
async function runHighLow({ channel, waitForDankMemer }) {
|
|
130
|
+
async function runHighLow({ channel, waitForDankMemer, useSlash = false, prefix = 'pls' }) {
|
|
131
131
|
LOG.cmd(`${c.white}${c.bold}pls hl${c.reset}`);
|
|
132
132
|
|
|
133
133
|
await sendCommand(channel, 'hl', { useSlash, prefix });
|
package/lib/commands/hunt.js
CHANGED
|
@@ -78,7 +78,7 @@ function pickDodgeLane(dragonPos, buttons) {
|
|
|
78
78
|
return buttons[Math.floor(Math.random() * buttons.length)];
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async function runHunt({ channel, waitForDankMemer, client }) {
|
|
81
|
+
async function runHunt({ channel, waitForDankMemer, client, useSlash = false, prefix = 'pls' }) {
|
|
82
82
|
LOG.cmd(`${c.white}${c.bold}pls hunt${c.reset}`);
|
|
83
83
|
|
|
84
84
|
await sendCommand(channel, 'hunt', { useSlash, prefix });
|
|
@@ -195,7 +195,7 @@ async function enrichItems(items) {
|
|
|
195
195
|
/**
|
|
196
196
|
* Check inventory for all pages and return full item list.
|
|
197
197
|
*/
|
|
198
|
-
async function runInventory({ channel, waitForDankMemer, client, accountId, redis, onPageProgress }) {
|
|
198
|
+
async function runInventory({ channel, waitForDankMemer, client, accountId, redis, onPageProgress, useSlash = false, prefix = 'pls' }) {
|
|
199
199
|
LOG.cmd(`${c.white}${c.bold}pls inv${c.reset}`);
|
|
200
200
|
|
|
201
201
|
await sendCommand(channel, 'inv', { useSlash, prefix });
|
|
@@ -35,7 +35,7 @@ async function refetchMsg(channel, msgId) {
|
|
|
35
35
|
* @param {function} opts.waitForDankMemer
|
|
36
36
|
* @returns {Promise<{result: string, coins: number}>}
|
|
37
37
|
*/
|
|
38
|
-
async function runPostMemes({ channel, waitForDankMemer }) {
|
|
38
|
+
async function runPostMemes({ channel, waitForDankMemer, useSlash = false, prefix = 'pls' }) {
|
|
39
39
|
LOG.cmd(`${c.white}${c.bold}pls pm${c.reset}`);
|
|
40
40
|
|
|
41
41
|
await sendCommand(channel, 'pm', { useSlash, prefix });
|
package/lib/commands/profile.js
CHANGED
|
@@ -201,7 +201,7 @@ async function getPlayerLevel({ channel, waitForDankMemer, accountId = 'default'
|
|
|
201
201
|
* @param {object} [opts.redis]
|
|
202
202
|
* @returns {Promise<object>} Parsed profile data
|
|
203
203
|
*/
|
|
204
|
-
async function runProfile({ channel, waitForDankMemer, accountId = 'default', redis }) {
|
|
204
|
+
async function runProfile({ channel, waitForDankMemer, accountId = 'default', redis, useSlash = false, prefix = 'pls' }) {
|
|
205
205
|
LOG.cmd(`${c.white}${c.bold}pls profile${c.reset}`);
|
|
206
206
|
await sendCommand(channel, 'profile', { useSlash, prefix });
|
|
207
207
|
const response = await waitForDankMemer(8000);
|
package/lib/commands/scratch.js
CHANGED
|
@@ -19,7 +19,7 @@ const { meetsLevelRequirement } = require('./profile');
|
|
|
19
19
|
* @param {object} [opts.redis]
|
|
20
20
|
* @returns {Promise<{result: string, coins: number}>}
|
|
21
21
|
*/
|
|
22
|
-
async function runScratch({ channel, waitForDankMemer, accountId, redis }) {
|
|
22
|
+
async function runScratch({ channel, waitForDankMemer, accountId, redis, useSlash = false, prefix = 'pls' }) {
|
|
23
23
|
// Check level 25 requirement before wasting a command
|
|
24
24
|
const canRun = await meetsLevelRequirement({ channel, waitForDankMemer, accountId, redis }, 25);
|
|
25
25
|
if (!canRun) {
|
package/lib/commands/search.js
CHANGED
|
@@ -82,7 +82,7 @@ function pickSafeButton(buttons, customSafe) {
|
|
|
82
82
|
* @param {string[]} [opts.safeAnswers] - Custom safe search locations
|
|
83
83
|
* @returns {Promise<{result: string, coins: number}>}
|
|
84
84
|
*/
|
|
85
|
-
async function runSearch({ channel, waitForDankMemer, safeAnswers }) {
|
|
85
|
+
async function runSearch({ channel, waitForDankMemer, safeAnswers, useSlash = false, prefix = 'pls' }) {
|
|
86
86
|
LOG.cmd(`${c.white}${c.bold}pls search${c.reset}`);
|
|
87
87
|
|
|
88
88
|
await sendCommand(channel, 'search', { useSlash, prefix });
|
package/lib/commands/stream.js
CHANGED
|
@@ -194,7 +194,7 @@ async function selectRandomStreamOption(msg) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
async function runStream({ channel, waitForDankMemer, client }) {
|
|
197
|
+
async function runStream({ channel, waitForDankMemer, client, useSlash = false, prefix = 'pls' }) {
|
|
198
198
|
LOG.cmd(`${c.white}${c.bold}pls stream${c.reset}`);
|
|
199
199
|
|
|
200
200
|
await sendCommand(channel, 'stream', { useSlash, prefix });
|
package/lib/commands/trivia.js
CHANGED
|
@@ -77,7 +77,7 @@ async function learnFromResult(question, correctAnswer, redis) {
|
|
|
77
77
|
LOG.debug(`[trivia] Learned: "${key.substring(0, 40)}..." β "${correctAnswer}"`);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
async function runTrivia({ channel, waitForDankMemer, redis }) {
|
|
80
|
+
async function runTrivia({ channel, waitForDankMemer, redis, useSlash = false, prefix = 'pls' }) {
|
|
81
81
|
LOG.cmd(`${c.white}${c.bold}pls trivia${c.reset}`);
|
|
82
82
|
|
|
83
83
|
await sendCommand(channel, 'trivia', { useSlash, prefix });
|
package/lib/commands/utils.js
CHANGED
|
@@ -65,20 +65,21 @@ async function sendCommand(channel, commandName, opts = {}) {
|
|
|
65
65
|
args = [],
|
|
66
66
|
} = opts;
|
|
67
67
|
|
|
68
|
+
// Only use slash if explicitly enabled
|
|
68
69
|
if (useSlash && channel?.sendSlash) {
|
|
69
70
|
try {
|
|
70
|
-
// sendSlash takes botId, commandName, ...args
|
|
71
71
|
await channel.sendSlash(DANK_MEMER_ID, commandName, ...args);
|
|
72
72
|
return;
|
|
73
73
|
} catch (e) {
|
|
74
|
-
|
|
74
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
75
|
+
LOG.warn(`[sendSlash] ${commandName} failed: ${msg} β falling back to text`);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
// Fallback:
|
|
79
|
+
// Fallback: always use pls prefix unless slash is explicitly enabled
|
|
79
80
|
const textCmd = args.length > 0
|
|
80
|
-
?
|
|
81
|
-
:
|
|
81
|
+
? `pls ${commandName} ${args.join(' ')}`
|
|
82
|
+
: `pls ${commandName}`;
|
|
82
83
|
await channel.send(textCmd);
|
|
83
84
|
}
|
|
84
85
|
|
package/lib/commands/work.js
CHANGED
|
@@ -404,7 +404,7 @@ async function handleGenericMinigame({ channel, current, waitForDankMemer }) {
|
|
|
404
404
|
* @param {function} opts.waitForDankMemer
|
|
405
405
|
* @returns {Promise<{result: string, coins: number, nextCooldownSec?: number}>}
|
|
406
406
|
*/
|
|
407
|
-
async function runWorkShift({ channel, waitForDankMemer }) {
|
|
407
|
+
async function runWorkShift({ channel, waitForDankMemer, useSlash = false, prefix = 'pls' }) {
|
|
408
408
|
LOG.cmd(`${c.white}${c.bold}pls work shift${c.reset}`);
|
|
409
409
|
|
|
410
410
|
await sendCommand(channel, 'work shift', { useSlash, prefix });
|
package/lib/grinder.js
CHANGED
|
@@ -1096,7 +1096,7 @@ class AccountWorker {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
|
|
1098
1098
|
async checkBalance(silent = false) {
|
|
1099
|
-
const prefix = this.account.use_slash ? '/' : 'pls';
|
|
1099
|
+
const prefix = !!this.account.use_slash ? '/' : 'pls';
|
|
1100
1100
|
const sentAt = Date.now();
|
|
1101
1101
|
|
|
1102
1102
|
const looksLikeBalance = (t) => {
|
|
@@ -1107,7 +1107,7 @@ class AccountWorker {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
|
|
1109
1109
|
// Fast path: send command, wait 3s, read from rawLogger
|
|
1110
|
-
if (this.account.use_slash && this.channel?.sendSlash) {
|
|
1110
|
+
if (!!this.account.use_slash && this.channel?.sendSlash) {
|
|
1111
1111
|
await this.channel.sendSlash(DANK_MEMER_ID, 'balance').catch(() => this.channel.send('/balance'));
|
|
1112
1112
|
} else {
|
|
1113
1113
|
await this.channel.send(`${prefix} bal`);
|
|
@@ -1126,7 +1126,7 @@ class AccountWorker {
|
|
|
1126
1126
|
// If rawLogger didn't capture it, fall back to waitForDankMemer
|
|
1127
1127
|
if (!text || !looksLikeBalance(text)) {
|
|
1128
1128
|
let response = await this.waitForDankMemer(8000);
|
|
1129
|
-
if (!response && this.account.use_slash) {
|
|
1129
|
+
if (!response && !!this.account.use_slash) {
|
|
1130
1130
|
await this.channel.send('pls bal');
|
|
1131
1131
|
response = await this.waitForDankMemer(8000);
|
|
1132
1132
|
}
|
|
@@ -1401,7 +1401,7 @@ class AccountWorker {
|
|
|
1401
1401
|
cmdName === 'crime' ? safeParseJSON(this.account.crime_answers, []) : [],
|
|
1402
1402
|
adventureAnswers: AccountWorker.ADVENTURE_ANSWERS,
|
|
1403
1403
|
useSlash: !!this.account.use_slash,
|
|
1404
|
-
prefix: this.account.use_slash ? '/' : 'pls',
|
|
1404
|
+
prefix: !!this.account.use_slash ? '/' : 'pls',
|
|
1405
1405
|
betAmount: this._questBetOverride || (['blackjack'].includes(cmdName) ? bjBet : gambBet),
|
|
1406
1406
|
accountId: this.account.id,
|
|
1407
1407
|
redis,
|
|
@@ -2458,7 +2458,7 @@ class AccountWorker {
|
|
|
2458
2458
|
} else {
|
|
2459
2459
|
this._questBetOverride = quest.bet || null;
|
|
2460
2460
|
}
|
|
2461
|
-
const prefix = this.account.use_slash ? '/' : 'pls';
|
|
2461
|
+
const prefix = !!this.account.use_slash ? '/' : 'pls';
|
|
2462
2462
|
|
|
2463
2463
|
if (quest.loseTarget) {
|
|
2464
2464
|
// Loss-target quest: keep playing until cumulative losses >= loseTarget
|
|
@@ -2742,7 +2742,7 @@ class AccountWorker {
|
|
|
2742
2742
|
await new Promise(r => setTimeout(r, minGap - timeSinceLastCmd));
|
|
2743
2743
|
}
|
|
2744
2744
|
|
|
2745
|
-
const prefix = this.account.use_slash ? '/' : 'pls';
|
|
2745
|
+
const prefix = !!this.account.use_slash ? '/' : 'pls';
|
|
2746
2746
|
this.setStatus(formatCommandName(item.cmd));
|
|
2747
2747
|
|
|
2748
2748
|
// Report "running" to dashboard
|
|
@@ -2869,7 +2869,7 @@ class AccountWorker {
|
|
|
2869
2869
|
if (!this.busy) {
|
|
2870
2870
|
this.log('info', 'Alert detected β running alert');
|
|
2871
2871
|
this.busy = true;
|
|
2872
|
-
const prefix = this.account.use_slash ? '/' : 'pls';
|
|
2872
|
+
const prefix = !!this.account.use_slash ? '/' : 'pls';
|
|
2873
2873
|
this.runCommand('alert', prefix).finally(() => { this.busy = false; });
|
|
2874
2874
|
}
|
|
2875
2875
|
}
|