dankgrinder 4.0.0 → 4.1.1

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/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # DankGrinder CLI
2
2
 
3
- Dank Memer automation engine — grind coins while you sleep.
3
+ Dank Memer automation engine — multi-account grinding with live TUI dashboard.
4
4
 
5
5
  ## Installation & Usage
6
6
 
7
7
  ```bash
8
8
  # Run directly (no install needed)
9
- npx dankgrinder --key dkg_your_api_key
9
+ npx dankgrinder --key dkg_your_api_key --url https://your-dashboard.com
10
10
 
11
11
  # Or install globally
12
12
  npm install -g dankgrinder
13
- dankgrinder --key dkg_your_api_key
13
+ dankgrinder --key dkg_your_api_key --url https://your-dashboard.com
14
14
  ```
15
15
 
16
16
  ## Options
@@ -18,30 +18,39 @@ dankgrinder --key dkg_your_api_key
18
18
  | Flag | Description | Default |
19
19
  |------|-------------|---------|
20
20
  | `--key <key>` | Your DankGrinder API key (required) | — |
21
- | `--url <url>` | API server URL | `http://localhost:3000` |
21
+ | `--url <url>` | API server URL (required) | |
22
22
  | `--help` | Show help | — |
23
23
  | `--version` | Show version | — |
24
24
 
25
25
  ## Setup
26
26
 
27
27
  1. Sign up at your DankGrinder dashboard
28
- 2. Go to **Config** → set your Discord token and channel ID
29
- 3. Enable the commands you want to automate
28
+ 2. Go to **Accounts** → add your Discord account(s) with token and channel ID
29
+ 3. Enable the commands you want to automate per account
30
30
  4. Go to **API Keys** → create a new key
31
- 5. Run: `npx dankgrinder --key dkg_your_key`
31
+ 5. Run: `npx dankgrinder --key dkg_your_key --url https://your-dashboard.com`
32
32
 
33
- ## Supported Commands
33
+ ## Supported Commands (30)
34
34
 
35
- - `pls hunt` Hunt animals for coins
36
- - `pls dig` — Dig for treasure
37
- - `pls beg` Beg for coins
38
- - `pls search` Search locations
39
- - `pls hl` Play highlow
40
- - `pls crime` Commit crime
41
- - `pls pm` — Post memes
35
+ | Category | Commands |
36
+ |----------|----------|
37
+ | **Grinding** | hunt, dig, fish, beg, search, crime, postmemes |
38
+ | **Games** | highlow, blackjack, coinflip, roulette, slots, snakeeyes, trivia, scratch |
39
+ | **Economy** | daily, weekly, monthly, work shift, stream, adventure, deposit |
40
+ | **Utility** | farm, tidy, use, drops, alert |
41
+
42
+ ## Features
43
+
44
+ - Multi-account support with per-account config
45
+ - Redis-backed cooldowns per command per account
46
+ - Live TUI dashboard with real-time stats
47
+ - Auto-buy tools (shovel, fishing pole, rifle) when missing
48
+ - Smart button/interaction handling for all mini-games
49
+ - Hold Tight detection with automatic cooldown management
42
50
 
43
51
  ## Requirements
44
52
 
45
53
  - Node.js 18+
46
54
  - A DankGrinder account with API key
47
- - Discord token configured in dashboard
55
+ - Discord token(s) configured in dashboard
56
+ - Redis (optional, for persistent cooldowns via `REDIS_URL` env var)
@@ -1,61 +1,98 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { start } = require('../lib/grinder');
4
+ const fs = require('fs');
5
+ const path = require('path');
4
6
 
7
+ const RC_PATH = path.join(require('os').homedir(), '.dankgrinderrc');
8
+ const pkg = require('../package.json');
5
9
  const args = process.argv.slice(2);
6
10
 
11
+ const C = {
12
+ r: '\x1b[0m', b: '\x1b[1m', d: '\x1b[2m',
13
+ red: '\x1b[31m', grn: '\x1b[32m', ylw: '\x1b[33m',
14
+ cyn: '\x1b[36m', mag: '\x1b[35m', wht: '\x1b[37m',
15
+ };
16
+
7
17
  if (args.includes('--help') || args.includes('-h')) {
8
18
  console.log(`
9
- \x1b[35m╔══════════════════════════════════════╗
10
- ║ \x1b[1mDankGrinder CLI v2.0\x1b[0m\x1b[35m ║
11
- ║ Multi-Account Automation Engine ║
12
- ╚══════════════════════════════════════╝\x1b[0m
13
-
14
- \x1b[1mUsage:\x1b[0m
15
- npx dankgrinder --key <API_KEY> [options]
16
-
17
- \x1b[1mOptions:\x1b[0m
18
- --key <key> Your DankGrinder API key (required)
19
- --url <url> API server URL (default: http://localhost:3000)
20
- --help, -h Show this help message
21
- --version, -v Show version
22
-
23
- \x1b[1mExamples:\x1b[0m
24
- npx dankgrinder --key dkg_abc123def456
25
- npx dankgrinder --key dkg_abc123def456 --url https://myserver.com
26
-
27
- \x1b[1mSetup:\x1b[0m
28
- 1. Sign up at your DankGrinder dashboard
29
- 2. Go to the Accounts page and add your Discord accounts
30
- 3. Configure per-account commands and cooldowns
31
- 4. Generate an API key from Auth Tokens
32
- 5. Run this CLI — it spawns one worker per active account
19
+ ${C.b}${C.mag}DANK${C.cyn}GRINDER${C.r} ${C.d}v${pkg.version}${C.r}
20
+
21
+ ${C.b}First time setup:${C.r}
22
+ npx dankgrinder --key <API_KEY> --url <DASHBOARD_URL>
23
+ ${C.d}(saves to ~/.dankgrinderrc — you won't need --url again)${C.r}
24
+
25
+ ${C.b}After setup:${C.r}
26
+ npx dankgrinder
27
+
28
+ ${C.b}Options:${C.r}
29
+ --key <key> API key from dashboard
30
+ --url <url> Dashboard URL (saved for future runs)
31
+ --reset Clear saved config
32
+ --help, -h Show this help
33
+ --version, -v Show version
33
34
  `);
34
35
  process.exit(0);
35
36
  }
36
37
 
37
38
  if (args.includes('--version') || args.includes('-v')) {
38
- const pkg = require('../package.json');
39
39
  console.log(`dankgrinder v${pkg.version}`);
40
40
  process.exit(0);
41
41
  }
42
42
 
43
+ if (args.includes('--reset')) {
44
+ try { fs.unlinkSync(RC_PATH); } catch {}
45
+ console.log(` ${C.grn}✓${C.r} Config cleared.`);
46
+ process.exit(0);
47
+ }
48
+
49
+ function loadConfig() {
50
+ try {
51
+ const raw = fs.readFileSync(RC_PATH, 'utf8');
52
+ return JSON.parse(raw);
53
+ } catch {
54
+ return {};
55
+ }
56
+ }
57
+
58
+ function saveConfig(key, url) {
59
+ const data = { key, url, saved_at: new Date().toISOString() };
60
+ fs.writeFileSync(RC_PATH, JSON.stringify(data, null, 2), 'utf8');
61
+ fs.chmodSync(RC_PATH, 0o600);
62
+ }
63
+
64
+ const saved = loadConfig();
65
+
43
66
  let apiKey = '';
44
- let apiUrl = 'http://localhost:3000';
67
+ let apiUrl = '';
45
68
 
46
69
  for (let i = 0; i < args.length; i++) {
47
70
  if (args[i] === '--key' && args[i + 1]) apiKey = args[i + 1];
48
71
  if (args[i] === '--url' && args[i + 1]) apiUrl = args[i + 1];
49
72
  }
50
73
 
74
+ apiKey = apiKey || process.env.DANKGRINDER_KEY || saved.key || '';
75
+ apiUrl = apiUrl || process.env.DANKGRINDER_URL || saved.url || '';
76
+
51
77
  if (!apiKey) {
52
- console.error('\x1b[31m✗ Missing API key.\x1b[0m');
53
- console.error('');
54
- console.error(' Usage: npx dankgrinder --key <YOUR_API_KEY>');
55
- console.error('');
56
- console.error(' Get your API key from the DankGrinder dashboard.');
57
- console.error(' Run \x1b[36mnpx dankgrinder --help\x1b[0m for more info.');
78
+ console.error(`\n ${C.red}✗ Missing API key.${C.r}\n`);
79
+ console.error(` ${C.b}First time?${C.r} Run:`);
80
+ console.error(` ${C.cyn}npx dankgrinder --key ${C.d}<YOUR_KEY>${C.r} ${C.cyn}--url ${C.d}<DASHBOARD_URL>${C.r}\n`);
81
+ console.error(` ${C.d}Get your API key from the dashboard → Auth Tokens page.${C.r}`);
82
+ console.error(` ${C.d}Your dashboard URL is the Railway/deployment URL.${C.r}\n`);
58
83
  process.exit(1);
59
84
  }
60
85
 
86
+ if (!apiUrl) {
87
+ console.error(`\n ${C.red}✗ Missing dashboard URL.${C.r}\n`);
88
+ console.error(` ${C.b}Run with --url once:${C.r}`);
89
+ console.error(` ${C.cyn}npx dankgrinder --key ${C.d}${apiKey.substring(0, 8)}...${C.r} ${C.cyn}--url ${C.d}https://your-app.up.railway.app${C.r}\n`);
90
+ console.error(` ${C.d}This is your Railway deployment URL. It will be saved for future runs.${C.r}\n`);
91
+ process.exit(1);
92
+ }
93
+
94
+ if (apiKey !== saved.key || apiUrl !== saved.url) {
95
+ saveConfig(apiKey, apiUrl);
96
+ }
97
+
61
98
  start(apiKey, apiUrl);