chore: deps + dev deps

+ Update @discordjs/builders
+ Update @discordjs/collection
+ Update @sapphire/shapeshift
+ Update discord-api-types
+ Update eslint
+ Update tsd
- Remove @discordjs/voice
+ @discordjs/voice patch v0.13
+ Fix `patchVoice` options
This commit is contained in:
March 7th 2022-10-14 18:12:47 +07:00
parent 7c07a80d83
commit 8b7a93bf22
7 changed files with 796 additions and 823 deletions

File diff suppressed because one or more lines are too long

View File

@ -52,17 +52,16 @@
"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.2.0", "@discordjs/builders": "^1.3.0",
"@discordjs/collection": "^1.1.0", "@discordjs/collection": "^1.2.0",
"@discordjs/voice": "^0.11.0",
"@sapphire/async-queue": "^1.5.0", "@sapphire/async-queue": "^1.5.0",
"@sapphire/shapeshift": "^3.6.0", "@sapphire/shapeshift": "^3.7.0",
"@types/node-fetch": "^2.6.2", "@types/node-fetch": "^2.6.2",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"axios": "^0.27.2", "axios": "^0.27.2",
"bignumber.js": "^9.1.0", "bignumber.js": "^9.1.0",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"discord-api-types": "^0.37.11", "discord-api-types": "^0.37.12",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
@ -84,7 +83,7 @@
"@types/node": "^16.11.12", "@types/node": "^16.11.12",
"conventional-changelog-cli": "^2.2.2", "conventional-changelog-cli": "^2.2.2",
"dtslint": "^4.2.1", "dtslint": "^4.2.1",
"eslint": "^8.24.0", "eslint": "^8.25.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3", "eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
@ -93,7 +92,7 @@
"jest": "^28.1.3", "jest": "^28.1.3",
"lint-staged": "^12.1.4", "lint-staged": "^12.1.4",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"tsd": "^0.22.0", "tsd": "^0.24.1",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "^4.8.3" "typescript": "^4.8.3"
} }

View File

@ -1,12 +1,10 @@
'use strict'; 'use strict';
let ClientUser; let ClientUser;
const { VoiceConnection } = require('@discordjs/voice');
const axios = require('axios'); const axios = require('axios');
const chalk = require('chalk'); const chalk = require('chalk');
const Discord = require('../../../index'); const Discord = require('../../../index');
const { Events, Opcodes } = require('../../../util/Constants'); const { Events, Opcodes } = require('../../../util/Constants');
const { VoiceConnection: VoiceConnection_patch } = require('../../../util/Voice');
let running = false; let running = false;
/** /**
* Emitted whenever clientOptions.checkUpdate = false * Emitted whenever clientOptions.checkUpdate = false
@ -65,15 +63,38 @@ module.exports = async (client, { d: data }, shard) => {
checkUpdate(client); checkUpdate(client);
if (client.options.patchVoice && !running) { if (client.options.patchVoice && !running) {
/* eslint-disable */ try {
VoiceConnection.prototype.configureNetworking = VoiceConnection_patch.prototype.configureNetworking; const { VoiceConnection } = require('@discordjs/voice');
client.emit( const { VoiceConnection: VoiceConnection_patch } = require('../../../util/Voice');
Events.DEBUG, /* eslint-disable */
`${chalk.greenBright('[OK]')} Patched ${chalk.cyanBright( VoiceConnection.prototype.configureNetworking = VoiceConnection_patch.prototype.configureNetworking;
'VoiceConnection.prototype.configureNetworking', client.emit(
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.11.0')}]`, Events.DEBUG,
); `${chalk.greenBright('[OK]')} Patched ${chalk.cyanBright(
/* eslint-enable */ 'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.13.0')}]`,
);
/* eslint-enable */
} catch (e) {
client.emit(
Events.DEBUG,
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.13.0')}]\n${e.stack}`,
);
client.emit(
Events.ERROR,
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
'VoiceConnection.prototype.configureNetworking',
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.13.0')}]`,
);
client.emit(
Events.ERROR,
`${chalk.redBright('[Error]')} Please install ${chalk.bgMagentaBright(
'@discordjs/voice',
)} version ${chalk.redBright('v0.13.0')}`,
);
}
} }
client.session_id = data.session_id; client.session_id = data.session_id;

View File

@ -116,31 +116,40 @@ class DMChannel extends Channel {
*/ */
call(options = {}) { call(options = {}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.client.api if (!this.client.options.patchVoice) {
.channels(this.id) reject(
.call.ring.post({ new Error(
data: { 'VOICE_NOT_PATCHED',
recipients: null, 'Enable voice patching in client options\nhttps://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ClientOptions',
}, ),
}) );
.catch(e => { } else {
console.error('Emit ring error:', e.message); this.client.api
}); .channels(this.id)
const connection = joinVoiceChannel({ .call.ring.post({
channelId: this.id, data: {
guildId: null, recipients: null,
adapterCreator: this.voiceAdapterCreator, },
selfDeaf: options.selfDeaf ?? false, })
selfMute: options.selfMute ?? false, .catch(e => {
}); console.error('Emit ring error:', e.message);
entersState(connection, VoiceConnectionStatus.Ready, 30000) });
.then(connection => { const connection = joinVoiceChannel({
resolve(connection); channelId: this.id,
}) guildId: null,
.catch(err => { adapterCreator: this.voiceAdapterCreator,
connection.destroy(); selfDeaf: options.selfDeaf ?? false,
reject(err); selfMute: options.selfMute ?? false,
}); });
entersState(connection, VoiceConnectionStatus.Ready, 30000)
.then(connection => {
resolve(connection);
})
.catch(err => {
connection.destroy();
reject(err);
});
}
}); });
} }
/** /**

View File

@ -311,31 +311,40 @@ class PartialGroupDMChannel extends Channel {
*/ */
call(options = {}) { call(options = {}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.client.api if (!this.client.options.patchVoice) {
.channels(this.id) reject(
.call.ring.post({ new Error(
body: { 'VOICE_NOT_PATCHED',
recipients: null, 'Enable voice patching in client options\nhttps://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ClientOptions',
}, ),
}) );
.catch(e => { } else {
console.error('Emit ring error:', e.message); this.client.api
}); .channels(this.id)
const connection = joinVoiceChannel({ .call.ring.post({
channelId: this.id, body: {
guildId: null, recipients: null,
adapterCreator: this.voiceAdapterCreator, },
selfDeaf: options.selfDeaf ?? false, })
selfMute: options.selfMute ?? false, .catch(e => {
}); console.error('Emit ring error:', e.message);
entersState(connection, VoiceConnectionStatus.Ready, 30000) });
.then(connection => { const connection = joinVoiceChannel({
resolve(connection); channelId: this.id,
}) guildId: null,
.catch(err => { adapterCreator: this.voiceAdapterCreator,
connection.destroy(); selfDeaf: options.selfDeaf ?? false,
reject(err); selfMute: options.selfMute ?? false,
}); });
entersState(connection, VoiceConnectionStatus.Ready, 30000)
.then(connection => {
resolve(connection);
})
.catch(err => {
connection.destroy();
reject(err);
});
}
}); });
} }
/** /**

View File

@ -38,7 +38,7 @@ const { randomUA } = require('../util/Constants');
* @property {boolean} [checkUpdate=true] Display module update information on the screen * @property {boolean} [checkUpdate=true] Display module update information on the screen
* @property {boolean} [readyStatus=true] Sync state with Discord Client * @property {boolean} [readyStatus=true] Sync state with Discord Client
* @property {boolean} [autoCookie=true] Automatically add Cookies to Request on startup * @property {boolean} [autoCookie=true] Automatically add Cookies to Request on startup
* @property {boolean} [patchVoice=true] Automatically patch @discordjs/voice module (support for call) * @property {boolean} [patchVoice=false] Automatically patch @discordjs/voice module (support for call)
* @property {boolean} [autoRedeemNitro=false] Automaticlly redeems nitro codes <NOTE: there is no cooldown on the auto redeem> * @property {boolean} [autoRedeemNitro=false] Automaticlly redeems nitro codes <NOTE: there is no cooldown on the auto redeem>
* @property {string} [proxy] Proxy to use for the WebSocket + REST connection (proxy-agent uri type) {@link https://www.npmjs.com/package/proxy-agent}. * @property {string} [proxy] Proxy to use for the WebSocket + REST connection (proxy-agent uri type) {@link https://www.npmjs.com/package/proxy-agent}.
* @property {boolean} [DMSync=false] Automatically synchronize call status (DM and group) at startup (event synchronization) [Warning: May cause rate limit to gateway) * @property {boolean} [DMSync=false] Automatically synchronize call status (DM and group) at startup (event synchronization) [Warning: May cause rate limit to gateway)
@ -149,7 +149,7 @@ class Options extends null {
autoCookie: true, autoCookie: true,
autoRedeemNitro: false, autoRedeemNitro: false,
DMSync: false, DMSync: false,
patchVoice: true, patchVoice: false,
waitGuildTimeout: 15_000, waitGuildTimeout: 15_000,
messageCreateEventGuildTimeout: 100, messageCreateEventGuildTimeout: 100,
shardCount: 1, shardCount: 1,

File diff suppressed because it is too large Load Diff