feat: update

- update deps
- node-fetch v3 > v2
- ...
This commit is contained in:
Elysia 2023-03-21 18:47:11 +07:00
parent e98fa2c7f3
commit 3e5058c828
8 changed files with 895 additions and 289 deletions

View File

@ -52,23 +52,23 @@
"homepage": "https://github.com/aiko-chan-ai/discord.js-selfbot-v13#readme", "homepage": "https://github.com/aiko-chan-ai/discord.js-selfbot-v13#readme",
"dependencies": { "dependencies": {
"@aikochan2k6/qrcode-terminal": "^0.12.1", "@aikochan2k6/qrcode-terminal": "^0.12.1",
"@discordjs/builders": "^1.4.0", "@discordjs/builders": "^1.5.0",
"@discordjs/collection": "^1.3.0", "@discordjs/collection": "^1.4.0",
"@discordjs/voice": "^0.14.0", "@discordjs/voice": "^0.15.0",
"@sapphire/async-queue": "^1.5.0", "@sapphire/async-queue": "^1.5.0",
"@sapphire/shapeshift": "^3.8.1", "@sapphire/shapeshift": "^3.8.1",
"@types/node-fetch": "^2.6.2", "@types/node-fetch": "^2.6.2",
"@types/ws": "^8.5.4", "@types/ws": "^8.5.4",
"axios": "1.1", "axios": "1.1",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"discord-api-types": "^0.37.31", "discord-api-types": "^0.37.36",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"node-fetch": "^3.3.0", "node-fetch": "^2.6.9",
"safe-base64": "^2.0.1-0", "safe-base64": "^2.0.1-0",
"string_decoder": "^1.3.0", "string_decoder": "^1.3.0",
"string-similarity": "^4.0.4", "string-similarity": "^4.0.4",
"ws": "^8.12.0" "ws": "^8.13.0"
}, },
"engines": { "engines": {
"node": ">=16.6.0", "node": ">=16.6.0",
@ -79,18 +79,18 @@
"@commitlint/config-angular": "^16.0.0", "@commitlint/config-angular": "^16.0.0",
"@discordjs/docgen": "^0.11.1", "@discordjs/docgen": "^0.11.1",
"@favware/npm-deprecate": "^1.0.7", "@favware/npm-deprecate": "^1.0.7",
"@types/node": "^18.13.0", "@types/node": "^18.15.5",
"conventional-changelog-cli": "^2.2.2", "conventional-changelog-cli": "^2.2.2",
"dtslint": "^4.2.1", "dtslint": "^4.2.1",
"eslint": "^8.33.0", "eslint": "^8.36.0",
"eslint-config-prettier": "^8.6.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", "husky": "^7.0.4",
"is-ci": "^3.0.1", "is-ci": "^3.0.1",
"jest": "^28.1.3", "jest": "^28.1.3",
"lint-staged": "^12.1.4", "lint-staged": "^12.1.4",
"prettier": "^2.8.4", "prettier": "^2.8.6",
"tsd": "^0.25.0", "tsd": "^0.25.0",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "^4.9.5" "typescript": "^4.9.5"

View File

@ -15,7 +15,7 @@ function patchVoice(client) {
'debug', 'debug',
`${chalk.greenBright('[OK]')} Patched ${chalk.cyanBright( `${chalk.greenBright('[OK]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking', 'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.14.0')}]`, )} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.15.0')}]`,
); );
/* eslint-enable */ /* eslint-enable */
} catch (e) { } catch (e) {
@ -23,19 +23,19 @@ function patchVoice(client) {
'debug', 'debug',
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright( `${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking', 'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.14.0')}]\n${e.stack}`, )} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.15.0')}]\n${e.stack}`,
); );
client.emit( client.emit(
Events.ERROR, Events.ERROR,
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright( `${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking', 'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.14.0')}]`, )} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.15.0')}]`,
); );
client.emit( client.emit(
Events.ERROR, Events.ERROR,
`${chalk.redBright('[Error]')} Please install ${chalk.bgMagentaBright( `${chalk.redBright('[Error]')} Please install ${chalk.bgMagentaBright(
'@discordjs/voice', '@discordjs/voice',
)} version ${chalk.redBright('v0.14.0')}`, )} version ${chalk.redBright('v0.15.0')}`,
); );
} }
} }

View File

@ -4,7 +4,7 @@ const Buffer = require('node:buffer').Buffer;
const https = require('node:https'); const https = require('node:https');
const { setTimeout } = require('node:timers'); const { setTimeout } = require('node:timers');
const FormData = require('form-data'); const FormData = require('form-data');
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args)); const fetch = require('node-fetch');
let agent = null; let agent = null;

View File

@ -9,9 +9,7 @@ const getUUID = () =>
// eslint-disable-next-line // eslint-disable-next-line
const checkUrl = url => { const checkUrl = url => {
try { try {
// eslint-disable-next-line no-new return new URL(url);
new URL(url);
return true;
} catch { } catch {
return false; return false;
} }
@ -194,7 +192,7 @@ class RichPresence {
if (!(this.assets instanceof Object)) this.assets = {}; if (!(this.assets instanceof Object)) this.assets = {};
if (typeof image != 'string') { if (typeof image != 'string') {
image = null; image = null;
} else if (checkUrl(image)) { } else if (['http:', 'https:'].includes(checkUrl(image)?.protocol)) {
// Discord URL: // Discord URL:
image = image image = image
.replace('https://cdn.discordapp.com/', 'mp:') .replace('https://cdn.discordapp.com/', 'mp:')
@ -231,7 +229,7 @@ https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichP
if (!(this.assets instanceof Object)) this.assets = {}; if (!(this.assets instanceof Object)) this.assets = {};
if (typeof image != 'string') { if (typeof image != 'string') {
image = null; image = null;
} else if (checkUrl(image)) { } else if (['http:', 'https:'].includes(checkUrl(image)?.protocol)) {
// Discord URL: // Discord URL:
image = image image = image
.replace('https://cdn.discordapp.com/', 'mp:') .replace('https://cdn.discordapp.com/', 'mp:')

View File

@ -4,7 +4,7 @@ const { Buffer } = require('node:buffer');
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
const stream = require('node:stream'); const stream = require('node:stream');
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args)); const fetch = require('node-fetch');
const { Error: DiscordError, TypeError } = require('../errors'); const { Error: DiscordError, TypeError } = require('../errors');
const Invite = require('../structures/Invite'); const Invite = require('../structures/Invite');

View File

@ -201,7 +201,7 @@ class Options extends null {
os_version: '10.0.22621', os_version: '10.0.22621',
os_arch: 'x64', os_arch: 'x64',
system_locale: 'en-US', system_locale: 'en-US',
client_build_number: 181113, client_build_number: 181832,
native_build_number: 30306, native_build_number: 30306,
client_event_source: null, client_event_source: null,
design_id: 0, design_id: 0,

View File

@ -266,7 +266,13 @@ new DiscordAuthWebsocket({
} }
} }
_throwError(error) { _throwError(error) {
throw error; if (error.request) {
// Axios error
console.dir(chalk.red(`[DiscordRemoteAuth] ERROR`), error);
throw new Error(`Request failed with status code ${error.response.status}`);
} else {
throw error;
}
} }
_send(op, data) { _send(op, data) {
if (!this.ws) this._throwError(new Error('WebSocket is not connected.')); if (!this.ws) this._throwError(new Error('WebSocket is not connected.'));

File diff suppressed because it is too large Load Diff