feat: update Options class with new client parameters and improve error messaging

This commit is contained in:
Elysia
2025-07-08 21:42:02 +07:00
parent 011aa4730e
commit 64a47093a8
4 changed files with 14 additions and 8616 deletions

View File

@@ -70,25 +70,17 @@
"node": ">=20.18" "node": ">=20.18"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^16.0.1",
"@commitlint/config-angular": "^16.0.0",
"@discordjs/docgen": "^0.11.1", "@discordjs/docgen": "^0.11.1",
"@favware/npm-deprecate": "^1.0.7",
"@types/debug": "^4.1.12", "@types/debug": "^4.1.12",
"@types/node": "^22.10.7", "@types/node": "^22.10.7",
"@types/ws": "^8.5.10", "@types/ws": "^8.5.10",
"conventional-changelog-cli": "^2.2.2",
"dtslint": "^4.2.1", "dtslint": "^4.2.1",
"eslint": "^8.39.0", "eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5", "eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"jest": "^28.1.3",
"lint-staged": "^12.1.4",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"tsd": "^0.28.1", "tsd": "^0.32.0",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }

8602
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
'use strict'; 'use strict';
const { randomUUID } = require('node:crypto');
const { UserAgent } = require('./Constants'); const { UserAgent } = require('./Constants');
const Intents = require('./Intents'); const Intents = require('./Intents');
@@ -163,7 +164,7 @@ class Options extends null {
captchaSolver: () => { captchaSolver: () => {
const err = new Error('CAPTCHA_SOLVER_NOT_IMPLEMENTED'); const err = new Error('CAPTCHA_SOLVER_NOT_IMPLEMENTED');
err.cause = err.cause =
'You need to provide a captcha solver to use this feature\nEx: const sbClient = new Client({ captchaSolver: yourAsyncFunction })'; 'You need to provide a captcha solver to use this feature\nExample: const client = new Client({ captchaSolver: yourAsyncFunction })';
throw err; throw err;
}, },
TOTPKey: null, TOTPKey: null,
@@ -199,11 +200,18 @@ class Options extends null {
os_version: '10', os_version: '10',
referrer: '', referrer: '',
referring_domain: '', referring_domain: '',
referrer_current: '', referrer_current: 'https://discord.com/channels/@me',
referring_domain_current: '', referring_domain_current: 'discord.com',
release_channel: 'stable', release_channel: 'stable',
client_build_number: 377668, client_build_number: 416351,
client_event_source: null, client_event_source: null,
client_launch_id: randomUUID(), // ?
client_heartbeat_session_id: randomUUID(), // ?
client_app_state: 'focused',
is_fast_connect: false,
latest_headless_tasks: [],
latest_headless_task_run_seconds_before: null,
gateway_connect_reasons: 'AppSkeleton',
}, },
compress: false, compress: false,
client_state: { client_state: {

View File

@@ -42,7 +42,7 @@
// Output Formatting // Output Formatting
"pretty": false, "pretty": false,
// Completeness // Completeness
"skipLibCheck": false, "skipLibCheck": true,
"skipDefaultLibCheck": true, "skipDefaultLibCheck": true,
} }
} }