From d491e77913a003e597022968d377be0b71342e25 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sun, 25 Dec 2022 18:54:45 +0700 Subject: [PATCH] fix: speedup start --- src/client/websocket/handlers/GUILD_CREATE.js | 1 + src/client/websocket/handlers/READY.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/websocket/handlers/GUILD_CREATE.js b/src/client/websocket/handlers/GUILD_CREATE.js index 4d10884..58f704c 100644 --- a/src/client/websocket/handlers/GUILD_CREATE.js +++ b/src/client/websocket/handlers/GUILD_CREATE.js @@ -4,6 +4,7 @@ const { Events, Opcodes, Status } = require('../../../util/Constants'); // Receive messages in large guilds const run = (client, guild) => { + if (!guild.large) return; client.ws.broadcast({ op: Opcodes.LAZY_REQUEST, d: { diff --git a/src/client/websocket/handlers/READY.js b/src/client/websocket/handlers/READY.js index bc34ad4..0af353f 100644 --- a/src/client/websocket/handlers/READY.js +++ b/src/client/websocket/handlers/READY.js @@ -141,8 +141,12 @@ module.exports = async (client, { d: data }, shard) => { client.guilds._add(guild); } + const largeGuilds = data.guilds.filter(g => g.large); + + client.emit('debug', `Received ${data.guilds.length} guilds, ${largeGuilds.length} large guilds`); + // Receive messages in large guilds - for (const guild of data.guilds) { + for (const guild of largeGuilds) { await client.sleep(client.options.messageCreateEventGuildTimeout); client.ws.broadcast({ op: Opcodes.LAZY_REQUEST,