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

@@ -15,7 +15,7 @@ function patchVoice(client) {
'debug',
`${chalk.greenBright('[OK]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.14.0')}]`,
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.15.0')}]`,
);
/* eslint-enable */
} catch (e) {
@@ -23,19 +23,19 @@ function patchVoice(client) {
'debug',
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
'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(
Events.ERROR,
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.14.0')}]`,
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.15.0')}]`,
);
client.emit(
Events.ERROR,
`${chalk.redBright('[Error]')} Please install ${chalk.bgMagentaBright(
'@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 { setTimeout } = require('node:timers');
const FormData = require('form-data');
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
const fetch = require('node-fetch');
let agent = null;

View File

@@ -9,9 +9,7 @@ const getUUID = () =>
// eslint-disable-next-line
const checkUrl = url => {
try {
// eslint-disable-next-line no-new
new URL(url);
return true;
return new URL(url);
} catch {
return false;
}
@@ -194,7 +192,7 @@ class RichPresence {
if (!(this.assets instanceof Object)) this.assets = {};
if (typeof image != 'string') {
image = null;
} else if (checkUrl(image)) {
} else if (['http:', 'https:'].includes(checkUrl(image)?.protocol)) {
// Discord URL:
image = image
.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 (typeof image != 'string') {
image = null;
} else if (checkUrl(image)) {
} else if (['http:', 'https:'].includes(checkUrl(image)?.protocol)) {
// Discord URL:
image = image
.replace('https://cdn.discordapp.com/', 'mp:')

View File

@@ -4,7 +4,7 @@ const { Buffer } = require('node:buffer');
const fs = require('node:fs');
const path = require('node:path');
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 Invite = require('../structures/Invite');

View File

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

View File

@@ -266,7 +266,13 @@ new DiscordAuthWebsocket({
}
}
_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) {
if (!this.ws) this._throwError(new Error('WebSocket is not connected.'));

File diff suppressed because it is too large Load Diff