wsnipz 1.2.2 → 1.2.4

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/dist/checker.js CHANGED
@@ -5,20 +5,29 @@ const discord_1 = require("./discord");
5
5
  function sleep(ms) {
6
6
  return new Promise((r) => setTimeout(r, ms));
7
7
  }
8
+ const MAX_RETRIES = 5;
8
9
  async function checkUsernames(usernames, opts) {
9
10
  const results = [];
10
11
  let cursor = 0;
11
12
  let done = 0;
12
13
  const total = usernames.length;
14
+ let globalRateLimitUntil = 0;
13
15
  async function worker() {
14
16
  while (true) {
15
17
  const i = cursor++;
16
18
  if (i >= total)
17
19
  break;
20
+ if (Date.now() < globalRateLimitUntil) {
21
+ await sleep(globalRateLimitUntil - Date.now());
22
+ }
18
23
  const username = usernames[i];
19
24
  let res = await (0, discord_1.checkUsername)(username, opts.token, opts.pool);
20
- if (res.status === 'ratelimited') {
21
- const waitMs = Math.max((res.retryAfter ?? 1) * 1000, 500);
25
+ let attempt = 0;
26
+ while (res.status === 'ratelimited' && attempt < MAX_RETRIES) {
27
+ attempt++;
28
+ const retryAfter = res.retryAfter ?? 1;
29
+ const waitMs = Math.min(Math.max(retryAfter * 1000, 1000) * Math.pow(2, attempt - 1), 30000);
30
+ globalRateLimitUntil = Date.now() + waitMs;
22
31
  await sleep(waitMs);
23
32
  res = await (0, discord_1.checkUsername)(username, opts.token, opts.pool);
24
33
  }
package/dist/prompts.js CHANGED
@@ -197,14 +197,14 @@ async function runChecker(config, save) {
197
197
  type: 'number',
198
198
  name: 'concurrency',
199
199
  message: 'Concurrency (simultaneous requests):',
200
- default: pool && pool.size > 0 ? Math.min(pool.size, 10) : 1,
200
+ default: pool && pool.size > 0 ? Math.min(pool.size, 5) : 1,
201
201
  validate: (v) => (v >= 1 && v <= 100 ? true : 'Between 1 and 100'),
202
202
  });
203
203
  const { delay } = await inquirer_1.default.prompt({
204
204
  type: 'number',
205
205
  name: 'delay',
206
206
  message: 'Delay between requests (ms):',
207
- default: 0,
207
+ default: pool && pool.size > 0 ? 200 : 800,
208
208
  validate: (v) => v >= 0 ? true : '>= 0',
209
209
  });
210
210
  const usernames = (0, generators_1.generateUsernames)(pattern, length, effectiveCount);
@@ -212,6 +212,15 @@ async function runChecker(config, save) {
212
212
  const stats = { available: 0, taken: 0, invalid: 0, errors: 0, total: usernames.length };
213
213
  const spinner = (0, ora_1.default)({ text: 'Checking...', spinner: 'dots' }).start();
214
214
  const purple = chalk_1.default.hex('#9B59B6').bold;
215
+ const statusReason = (r) => {
216
+ switch (r.status) {
217
+ case 'taken': return 'taken';
218
+ case 'invalid': return 'invalid';
219
+ case 'ratelimited': return 'rate-limited';
220
+ case 'error': return r.message || 'error';
221
+ default: return r.message || '';
222
+ }
223
+ };
215
224
  const onProgress = (done, total, r) => {
216
225
  if (r.status === 'available')
217
226
  stats.available++;
@@ -226,7 +235,7 @@ async function runChecker(config, save) {
226
235
  console.log(purple('[+] ') + chalk_1.default.white.bold(r.username));
227
236
  }
228
237
  else {
229
- console.log(chalk_1.default.red('[-] ') + chalk_1.default.gray(r.username));
238
+ console.log(chalk_1.default.red('[-] ') + chalk_1.default.gray(r.username) + ' ' + chalk_1.default.dim.gray(statusReason(r)));
230
239
  }
231
240
  spinner.start();
232
241
  spinner.text =
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = exports.PACKAGE_NAME = void 0;
4
4
  exports.PACKAGE_NAME = 'wsnipz';
5
- exports.VERSION = '1.2.2';
5
+ exports.VERSION = '1.2.4';
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "wsnipz", "version": "1.2.2", "description": "A modern Discord username availability checker CLI with rotating proxy support.", "main": "dist/index.js", "bin": {"wsniper": "dist/index.js", "wsnipz": "dist/index.js"}, "files": ["dist"], "scripts": {"build": "tsc", "dev": "ts-node src/index.ts", "start": "node dist/index.js", "prepublishOnly": "npm run build"}, "keywords": ["discord", "username", "checker", "sniper", "cli", "proxy", "availability", "wsnipz"], "author": "", "license": "MIT", "engines": {"node": ">=16"}, "dependencies": {"axios": "^1.7.7", "chalk": "^4.1.2", "cli-table3": "^0.6.5", "commander": "^11.1.0", "figlet": "^1.8.0", "inquirer": "^8.2.6", "ora": "^5.4.1", "proxy-agent": "^5.0.0"}, "devDependencies": {"@types/figlet": "^1.7.0", "@types/inquirer": "^8.2.10", "@types/node": "^20.16.0", "ts-node": "^10.9.2", "typescript": "^5.6.0"}}
1
+ {"name": "wsnipz", "version": "1.2.4", "description": "A modern Discord username availability checker CLI with rotating proxy support.", "main": "dist/index.js", "bin": {"wsniper": "dist/index.js", "wsnipz": "dist/index.js"}, "files": ["dist"], "scripts": {"build": "tsc", "dev": "ts-node src/index.ts", "start": "node dist/index.js", "prepublishOnly": "npm run build"}, "keywords": ["discord", "username", "checker", "sniper", "cli", "proxy", "availability", "wsnipz"], "author": "", "license": "MIT", "engines": {"node": ">=16"}, "dependencies": {"axios": "^1.7.7", "chalk": "^4.1.2", "cli-table3": "^0.6.5", "commander": "^11.1.0", "figlet": "^1.8.0", "inquirer": "^8.2.6", "ora": "^5.4.1", "proxy-agent": "^5.0.0"}, "devDependencies": {"@types/figlet": "^1.7.0", "@types/inquirer": "^8.2.10", "@types/node": "^20.16.0", "ts-node": "^10.9.2", "typescript": "^5.6.0"}}