feat(ClientOptions): Add messageCreateEventGuildTimeout
`
Increase timeout each time WS send If you don't want a timeout, set it to `0` Co-Authored-By: Nguyễn Hồng Đức <hongducyb123@gmail.com>
This commit is contained in:
parent
9f33ab1cfd
commit
1587b12d22
@ -35,7 +35,7 @@
|
|||||||
### <strong>[Extend Document (With Example)](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/tree/main/Document)</strong>
|
### <strong>[Extend Document (With Example)](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/tree/main/Document)</strong>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- [x] Message: Send, Recieve, Delete, Edit, Pin, Reaction Emoji, Attachments, Embeds (WebEmbed), Mentions, Webhooks, etc.
|
- [x] Message: Send, Receive, Delete, Edit, Pin, Reaction Emoji, Attachments, Embeds (WebEmbed), Mentions, Webhooks, etc.
|
||||||
- [x] User: Settings, Status, Activity, DeveloperPortal, RemoteAuth, etc.
|
- [x] User: Settings, Status, Activity, DeveloperPortal, RemoteAuth, etc.
|
||||||
- [X] Guild: Fetch Members, Join / Leave, Roles, Channels, etc.
|
- [X] Guild: Fetch Members, Join / Leave, Roles, Channels, etc.
|
||||||
- [X] Interactions: Slash Commands, Click Buttons, Using Menu, Modal, Context Menu, etc.
|
- [X] Interactions: Slash Commands, Click Buttons, Using Menu, Modal, Context Menu, etc.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -918,6 +918,9 @@ class Client extends BaseClient {
|
|||||||
if (typeof options.waitGuildTimeout !== 'number' || isNaN(options.waitGuildTimeout)) {
|
if (typeof options.waitGuildTimeout !== 'number' || isNaN(options.waitGuildTimeout)) {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'waitGuildTimeout', 'a number');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'waitGuildTimeout', 'a number');
|
||||||
}
|
}
|
||||||
|
if (typeof options.messageCreateEventGuildTimeout !== 'number' || isNaN(options.messageCreateEventGuildTimeout)) {
|
||||||
|
throw new TypeError('CLIENT_INVALID_OPTION', 'messageCreateEventGuildTimeout', 'a number');
|
||||||
|
}
|
||||||
if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) {
|
if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'restWsBridgeTimeout', 'a number');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'restWsBridgeTimeout', 'a number');
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ async function checkUpdate(client) {
|
|||||||
return client.emit('update', Discord.version, latest_tag);
|
return client.emit('update', Discord.version, latest_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = (client, { d: data }, shard) => {
|
module.exports = async (client, { d: data }, shard) => {
|
||||||
checkUpdate(client);
|
checkUpdate(client);
|
||||||
|
|
||||||
if (client.options.patchVoice && !running) {
|
if (client.options.patchVoice && !running) {
|
||||||
@ -146,7 +146,8 @@ module.exports = (client, { d: data }, shard) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Receive messages in large guilds
|
// Receive messages in large guilds
|
||||||
client.guilds.cache.map(guild => {
|
for (const guild of data.guilds) {
|
||||||
|
await client.sleep(client.options.messageCreateEventGuildTimeout);
|
||||||
client.ws.broadcast({
|
client.ws.broadcast({
|
||||||
op: Opcodes.LAZY_REQUEST,
|
op: Opcodes.LAZY_REQUEST,
|
||||||
d: {
|
d: {
|
||||||
@ -156,13 +157,10 @@ module.exports = (client, { d: data }, shard) => {
|
|||||||
activities: true,
|
activities: true,
|
||||||
thread_member_lists: [],
|
thread_member_lists: [],
|
||||||
members: [],
|
members: [],
|
||||||
channels: {
|
channels: {},
|
||||||
// [guild.channels.cache.first().id]: [[0, 99]],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return true;
|
}
|
||||||
});
|
|
||||||
|
|
||||||
client.relationships._setup(data.relationships);
|
client.relationships._setup(data.relationships);
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ const { randomUA } = require('../util/Constants');
|
|||||||
* @property {PresenceData} [presence={}] Presence data to use upon login
|
* @property {PresenceData} [presence={}] Presence data to use upon login
|
||||||
* @property {IntentsResolvable} [intents=131071] Intents to enable for this connection (but not using)
|
* @property {IntentsResolvable} [intents=131071] Intents to enable for this connection (but not using)
|
||||||
* @property {number} [waitGuildTimeout=15000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
* @property {number} [waitGuildTimeout=15000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
||||||
|
* @property {number} [messageCreateEventGuildTimeout=100] Time in milliseconds that Clients to register for messages with each guild
|
||||||
* missing guilds to be received before starting the bot. If not specified, the default is 15 seconds.
|
* missing guilds to be received before starting the bot. If not specified, the default is 15 seconds.
|
||||||
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
|
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
|
||||||
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
||||||
@ -149,6 +150,7 @@ class Options extends null {
|
|||||||
DMSync: false,
|
DMSync: false,
|
||||||
patchVoice: true,
|
patchVoice: true,
|
||||||
waitGuildTimeout: 15_000,
|
waitGuildTimeout: 15_000,
|
||||||
|
messageCreateEventGuildTimeout: 100,
|
||||||
shardCount: 1,
|
shardCount: 1,
|
||||||
makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
|
makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
|
||||||
messageCacheLifetime: 0,
|
messageCacheLifetime: 0,
|
||||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -4564,6 +4564,7 @@ export interface ClientOptions {
|
|||||||
presence?: PresenceData;
|
presence?: PresenceData;
|
||||||
intents?: BitFieldResolvable<IntentsString, number>;
|
intents?: BitFieldResolvable<IntentsString, number>;
|
||||||
waitGuildTimeout?: number;
|
waitGuildTimeout?: number;
|
||||||
|
messageCreateEventGuildTimeout?: number;
|
||||||
sweepers?: SweeperOptions;
|
sweepers?: SweeperOptions;
|
||||||
ws?: WebSocketOptions;
|
ws?: WebSocketOptions;
|
||||||
http?: HTTPOptions;
|
http?: HTTPOptions;
|
||||||
|
Loading…
Reference in New Issue
Block a user