Optional
customA custom socket URL to connect to.
Useful if you use a proxy to connect to the Discord gateway.
If customGatewayBotEndpoint
is defined, its response's url
parameter is overwritten by this.
Note that gateway URL query parameters will still be sent.
null
Optional
customIf customGatewaySocketURL
is defined and this is true
, the resume_gateway_url
field in the READY dispatch is used instead of the customGatewaySocketURL
.
Otherwise, if customGatewaySocketURL
is defined, it's used for connecting and resuming.
null
Optional
customA custom URL to use as a substitute for GET /gateway/bot
.
Useful if you use a proxy to connect to the Discord gateway, and it handles bot instances / sharding.
This should be the full URL, not just a route (Example: https://api.example.com/gateway
, not /gateway
).
It is expected that making a request to this URL returns the same response that Discord normally would.
If the response returns your system's socket URL as the url
parameter, there is no need to specify customGatewaySocketURL
.
Additionally, if you use a custom base URL for the rest manager that returns custom information when GET /gateway/bot
is called, this can be left undefined.
null
Optional
disableIf the rate limit on buckets (used for shard spawning) should be disabled.
Only disable spawning rate limits if you are using a separate application to manage rate limits (customGatewaySocketURL
and/or customGatewayBotEndpoint
can be used to do so).
Note that shards are still spawned in the order that they would with rate limiting enabled, just without a pause between bucket spawn calls.
false
Optional
guildsThe time to wait in milliseconds after the last GUILD_CREATE event to consider that guilds are ready.
15000
Optional
intentsGateway intents.
A numerical value is simply passed to the identify payload.
An array of intent names will only enable the specified intents.
all
enables all intents, including privileged intents.
nonPrivileged
enables all non-privileged intents.
nonPrivileged
Optional
largeThe number of members in a guild to reach before the gateway stops sending offline members in the guild member list.
Must be between 50
and 250
.
50
Optional
presenceOptional
shardingGateway sharding.
Unless you are using a custom scaling solution (for example, running your bot across numerous servers or processes), it is recommended that you leave all of these options undefined.
If you wish to manually specify the number of shards to spawn across your bot, you only need to set GatewayOptions#sharding#totalBotShards
.
When using a Client
, specified options are passed directly to the gateway manager, without manipulation.
{}
Optional
offset?: numberThe number of shards to offset spawning by.
For example, with the following configuration, the last 2 of the total 4 shards would be spawned.
sharding: {
totalBotShards: 4,
shards: 2,
offset: 2
}
This option should only be manually defined if you are using a custom scaling solution externally from the library and hosting multiple instances of your bot, to prevent unexpected behavior.
Optional
shards?: numberThe amount of shards to spawn.
By default, GatewayOptions#sharding#totalBotShards
is used.
Optional
totalThe number of shards the bot will have in total.
This value is used for the num_shards
property sent in the identify payload.
This is NOT the amount of shards the process will spawn. For that option, specify GatewayOptions#sharding#shards
.
auto
will use the recommended number from Discord.
Optional
spawnThe number of milliseconds to wait between spawn and resume attempts.
2500
Optional
versionOptional
wsGenerated using TypeDoc
Gateway options.