feat: remove messageCreateEventGuildTimeout & change UA default

This commit is contained in:
Elysia
2024-01-23 21:03:42 +07:00
parent 87d0334eb8
commit 2472642184
5 changed files with 39 additions and 35 deletions

View File

@@ -677,9 +677,6 @@ class Client extends BaseClient {
if (!Array.isArray(options.partials)) {
throw new TypeError('CLIENT_INVALID_OPTION', 'partials', 'an Array');
}
if (typeof options.messageCreateEventGuildTimeout !== 'number' || isNaN(options.messageCreateEventGuildTimeout)) {
throw new TypeError('CLIENT_INVALID_OPTION', 'messageCreateEventGuildTimeout', 'a number');
}
if (typeof options.DMChannelVoiceStatusSync !== 'number' || isNaN(options.DMChannelVoiceStatusSync)) {
throw new TypeError('CLIENT_INVALID_OPTION', 'DMChannelVoiceStatusSync', 'a number');
}

View File

@@ -38,23 +38,27 @@ module.exports = (client, { d: data }, shard) => {
// ClientSetting
client.settings._patch(data.user_settings);
if (largeGuilds.length) {
client.ws.broadcast({
op: Opcodes.GUILD_SUBSCRIPTIONS_BULK,
d: {
subscriptions: largeGuilds.reduce((accumulator, guild) => {
accumulator[guild.id] = {
typing: true,
threads: true,
activities: true,
member_updates: true,
thread_member_lists: [],
members: [],
channels: {},
};
return accumulator;
}, {}),
},
});
}
Promise.all(
largeGuilds.map(async (guild, index) => {
client.ws.broadcast({
op: Opcodes.GUILD_SUBSCRIPTIONS,
d: {
guild_id: guild.id,
typing: true,
threads: true,
activities: true,
thread_member_lists: [],
members: [],
channels: {},
},
});
client.emit('debug', `[READY] Register guild ${guild.id}`);
await client.sleep(client.options.messageCreateEventGuildTimeout * index);
}),
data.private_channels.map(async (c, index) => {
if (client.options.DMChannelVoiceStatusSync < 1) return;
client.ws.broadcast({