feat: Switch User

test #477
This commit is contained in:
March 7th
2023-01-26 13:40:51 +07:00
parent e8c3bcb0a0
commit 4c838a5e26
14 changed files with 79 additions and 60 deletions

View File

@@ -2,7 +2,6 @@
const EventEmitter = require('node:events');
const { setTimeout, setInterval, clearTimeout } = require('node:timers');
const proxy = require('proxy-agent');
const WebSocket = require('../../WebSocket');
const { Status, Events, ShardEvents, Opcodes, WSEvents, WSCodes } = require('../../util/Constants');
const Intents = require('../../util/Intents');
@@ -278,6 +277,7 @@ class WebSocketShard extends EventEmitter {
let args = { handshakeTimeout: 30_000 };
if (client.options.proxy.length > 0) {
const proxy = require('proxy-agent');
args.agent = new proxy(client.options.proxy);
this.debug(`Using proxy ${client.options.proxy}`, args);
}
@@ -548,7 +548,8 @@ class WebSocketShard extends EventEmitter {
this.status = Status.READY;
this.emit(ShardEvents.ALL_READY, this.expectedGuilds);
}, hasGuildsIntent && waitGuildTimeout).unref();
// }, hasGuildsIntent && waitGuildTimeout).unref();
}, 1).unref();
}
/**

View File

@@ -94,7 +94,7 @@ module.exports = async (client, { d: data }, shard) => {
patchVoice(client);
}
if (client.options.readyStatus) {
if (client.options.syncStatus) {
client.customStatusAuto(client);
}
firstReady = true;

View File

@@ -2,7 +2,7 @@
const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => {
client.settings._patch(data);
if (('status' in data || 'custom_status' in data) && client.options.readyStatus) {
if (('status' in data || 'custom_status' in data) && client.options.syncStatus) {
client.customStatusAuto(client);
}
return client.emit(Events.USER_SETTINGS_UPDATE, data);