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

View File

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

View File

@ -116,31 +116,40 @@ class DMChannel extends Channel {
*/
call(options = {}) {
return new Promise((resolve, reject) => {
this.client.api
.channels(this.id)
.call.ring.post({
data: {
recipients: null,
},
})
.catch(e => {
console.error('Emit ring error:', e.message);
});
const connection = joinVoiceChannel({
channelId: this.id,
guildId: null,
adapterCreator: this.voiceAdapterCreator,
selfDeaf: options.selfDeaf ?? false,
selfMute: options.selfMute ?? false,
});
entersState(connection, VoiceConnectionStatus.Ready, 30000)
.then(connection => {
resolve(connection);
})
.catch(err => {
connection.destroy();
reject(err);
if (!this.client.options.patchVoice) {
reject(
new Error(
'VOICE_NOT_PATCHED',
'Enable voice patching in client options\nhttps://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ClientOptions',
),
);
} else {
this.client.api
.channels(this.id)
.call.ring.post({
data: {
recipients: null,
},
})
.catch(e => {
console.error('Emit ring error:', e.message);
});
const connection = joinVoiceChannel({
channelId: this.id,
guildId: null,
adapterCreator: this.voiceAdapterCreator,
selfDeaf: options.selfDeaf ?? false,
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 = {}) {
return new Promise((resolve, reject) => {
this.client.api
.channels(this.id)
.call.ring.post({
body: {
recipients: null,
},
})
.catch(e => {
console.error('Emit ring error:', e.message);
});
const connection = joinVoiceChannel({
channelId: this.id,
guildId: null,
adapterCreator: this.voiceAdapterCreator,
selfDeaf: options.selfDeaf ?? false,
selfMute: options.selfMute ?? false,
});
entersState(connection, VoiceConnectionStatus.Ready, 30000)
.then(connection => {
resolve(connection);
})
.catch(err => {
connection.destroy();
reject(err);
if (!this.client.options.patchVoice) {
reject(
new Error(
'VOICE_NOT_PATCHED',
'Enable voice patching in client options\nhttps://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ClientOptions',
),
);
} else {
this.client.api
.channels(this.id)
.call.ring.post({
body: {
recipients: null,
},
})
.catch(e => {
console.error('Emit ring error:', e.message);
});
const connection = joinVoiceChannel({
channelId: this.id,
guildId: null,
adapterCreator: this.voiceAdapterCreator,
selfDeaf: options.selfDeaf ?? false,
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} [readyStatus=true] Sync state with Discord Client
* @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 {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)
@ -149,7 +149,7 @@ class Options extends null {
autoCookie: true,
autoRedeemNitro: false,
DMSync: false,
patchVoice: true,
patchVoice: false,
waitGuildTimeout: 15_000,
messageCreateEventGuildTimeout: 100,
shardCount: 1,

File diff suppressed because it is too large Load Diff