dankgrinder 7.60.0 → 7.62.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/market.js +16 -12
- package/lib/grinder.js +4 -3
- package/package.json +1 -1
package/lib/commands/market.js
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
* Handles sell listings with optional partial sales and privacy settings.
|
|
5
5
|
*
|
|
6
6
|
* Dank Memer market post format:
|
|
7
|
-
* pls market post for_coins <listing_type> <qty> <item> <price>
|
|
7
|
+
* pls market post for_coins <listing_type> <qty> <item> <price>
|
|
8
|
+
* <allow_partial> <is_private> <partial_min> <days>
|
|
8
9
|
*
|
|
9
10
|
* listing_type: "sell" | "auction"
|
|
10
11
|
* allow_partial: "true" | "false"
|
|
11
12
|
* is_private: "true" | "false"
|
|
12
|
-
* partial_min:
|
|
13
|
+
* partial_min: integer ≥ 1
|
|
14
|
+
* days: 1-7
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
17
|
const {
|
|
@@ -48,17 +50,19 @@ async function runMarketPost({
|
|
|
48
50
|
return { result: 'no item specified', coins: 0 };
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
// Dank Memer expects: <qty> <item> <price> <allow_partial> <is_private> <days> <partial_min>
|
|
54
|
+
// Note: allow_partial and is_private come BEFORE days (verified via test-market.js)
|
|
51
55
|
const cmdParts = [
|
|
52
56
|
'pls', 'market', 'post',
|
|
53
|
-
'for_coins',
|
|
54
|
-
'sell',
|
|
55
|
-
String(quantity),
|
|
56
|
-
itemName,
|
|
57
|
-
String(pricePerItem * quantity),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
String(
|
|
57
|
+
'for_coins', // price type: fixed price
|
|
58
|
+
'sell', // listing type
|
|
59
|
+
String(quantity), // quantity
|
|
60
|
+
itemName, // item name
|
|
61
|
+
String(pricePerItem * quantity), // TOTAL price
|
|
62
|
+
allowPartial ? 'true' : 'false', // allow partial
|
|
63
|
+
isPrivate ? 'true' : 'false', // is private
|
|
64
|
+
String(Math.max(1, partialMin || 1)), // partial minimum (always ≥1)
|
|
65
|
+
String(days), // days (1-7)
|
|
62
66
|
];
|
|
63
67
|
|
|
64
68
|
const cmdString = cmdParts.join(' ');
|
|
@@ -84,7 +88,7 @@ async function runMarketPost({
|
|
|
84
88
|
|
|
85
89
|
// Check for common errors
|
|
86
90
|
const lowerText = text.toLowerCase();
|
|
87
|
-
if (lowerText.includes('you don\'t have') || lowerText.includes('not enough') || lowerText.includes('invalid item') || lowerText.includes('partial minimum can\'t') || lowerText.includes('set allow_partial')) {
|
|
91
|
+
if (lowerText.includes('you don\'t have') || lowerText.includes('not enough') || lowerText.includes('invalid item') || lowerText.includes('partial minimum can\'t') || lowerText.includes('set allow_partial') || lowerText.includes('allow_partial is incorrect') || lowerText.includes('allow_partial')) {
|
|
88
92
|
return { result: text.substring(0, 80) || 'error listing item', coins: 0 };
|
|
89
93
|
}
|
|
90
94
|
|
package/lib/grinder.js
CHANGED
|
@@ -1816,7 +1816,8 @@ class AccountWorker {
|
|
|
1816
1816
|
if (currentLevel > 0) {
|
|
1817
1817
|
await redis.set(`dkg:level:${this.account.id}`, String(currentLevel), 'EX', 2592000);
|
|
1818
1818
|
this._level = currentLevel;
|
|
1819
|
-
|
|
1819
|
+
// Only log to terminal during startup — after dashboardStarted, go to live feed
|
|
1820
|
+
if (dashboardStarted) this.log('info', `DM level: ${c.bold}${currentLevel}${c.reset}`);
|
|
1820
1821
|
}
|
|
1821
1822
|
if (lastLifesaverCount >= 0) {
|
|
1822
1823
|
await redis.set(`dkg:lifesavers:${this.account.id}`, String(lastLifesaverCount), 'EX', 86400);
|
|
@@ -1824,7 +1825,7 @@ class AccountWorker {
|
|
|
1824
1825
|
if (lastLifesaverCount === 0) {
|
|
1825
1826
|
await redis.set(`raw:alert:no-lifesaver:${dm.id}`, '1', 'EX', 86400);
|
|
1826
1827
|
await redis.set(`raw:alert:no-lifesaver:${this.channel?.id}`, '1', 'EX', 86400);
|
|
1827
|
-
this.log('error', `${c.red}0 LIFESAVERS! Crime/Search will be disabled.${c.reset}`);
|
|
1828
|
+
if (dashboardStarted) this.log('error', `${c.red}0 LIFESAVERS! Crime/Search will be disabled.${c.reset}`);
|
|
1828
1829
|
}
|
|
1829
1830
|
}
|
|
1830
1831
|
}
|
|
@@ -1837,7 +1838,7 @@ class AccountWorker {
|
|
|
1837
1838
|
}
|
|
1838
1839
|
}
|
|
1839
1840
|
}
|
|
1840
|
-
this.log('debug', `DM check failed after ${maxRetries} attempts: ${lastError.message}`);
|
|
1841
|
+
if (dashboardStarted) this.log('debug', `DM check failed after ${maxRetries} attempts: ${lastError.message}`);
|
|
1841
1842
|
return { deaths: 0, levelUps: 0, currentLevel: 0, lifesavers: -1 };
|
|
1842
1843
|
}
|
|
1843
1844
|
|