CreateGatewayManagerOptions
Documentation / @discordeno/gateway / CreateGatewayManagerOptions
Interface: CreateGatewayManagerOptions
Defined in: gateway/src/manager.ts:577
Properties
cache?
optional
cache:object
Defined in: gateway/src/manager.ts:673
This managers cache related settings.
requestMembers?
optional
requestMembers:object
requestMembers.enabled?
optional
requestMembers.enabled:boolean
Whether or not request member requests should be cached.
Default
false
compress?
optional
compress:boolean
Defined in: gateway/src/manager.ts:632
Whether incoming payloads are compressed using zlib.
Default
false
connection?
optional
connection:object
Defined in: gateway/src/manager.ts:627
Important data which is used by the manager to connect shards to the gateway.
sessionStartLimit
sessionStartLimit:
object
sessionStartLimit.maxConcurrency
sessionStartLimit.maxConcurrency:
number
sessionStartLimit.remaining
sessionStartLimit.remaining:
number
sessionStartLimit.resetAfter
sessionStartLimit.resetAfter:
number
sessionStartLimit.total
sessionStartLimit.total:
number
shards
shards:
number
url
url:
string
events?
optional
events:ShardEvents
Defined in: gateway/src/manager.ts:671
The events handlers
firstShardId?
optional
firstShardId:number
Defined in: gateway/src/manager.ts:582
Id of the first Shard which should get controlled by this manager.
Default
0
intents?
optional
intents:number
Defined in: gateway/src/manager.ts:639
The calculated intent value of the events which the shard should receive.
Default
0
lastShardId?
optional
lastShardId:number
Defined in: gateway/src/manager.ts:587
Id of the last Shard which should get controlled by this manager.
Default
0
logger?
optional
logger:Pick
<{},"debug"
|"info"
|"warn"
|"error"
|"fatal"
>
Defined in: gateway/src/manager.ts:686
The logger that the gateway manager will use.
Default
logger // The logger exported by @discordeno/utils
makePresence()?
optional
makePresence: () =>Promise
<undefined
|DiscordUpdatePresence
>
Defined in: gateway/src/manager.ts:693
Make the presence for when the bot connects to the gateway
Returns
Promise
<undefined
| DiscordUpdatePresence
>
Remarks
This function will be called each time a Shard is going to identify
preferSnakeCase?
optional
preferSnakeCase:boolean
Defined in: gateway/src/manager.ts:597
Whether to send the discord packets in snake case form.
Default
false
properties?
optional
properties:object
Defined in: gateway/src/manager.ts:641
Identify properties to use
browser
browser:
string
The "browser" where this shard is running on.
Default
"Discordeno"
device
device:
string
The device on which the shard is running.
Default
"Discordeno"
os
os:
string
Operating system the shard runs on.
Default
"darwin" | "linux" | "windows"
resharding?
optional
resharding:object
Defined in: gateway/src/manager.ts:695
Options related to resharding.
checkInterval
checkInterval:
number
The interval in milliseconds, of how often to check whether resharding is needed and reshard automatically. Set to -1 to disable auto resharding.
Default
28800000 (8 hours)
enabled
enabled:
boolean
Whether or not automated resharding should be enabled.
Default
true
getSessionInfo()?
optional
getSessionInfo: () =>Promise
<{sessionStartLimit
: {maxConcurrency
:number
;remaining
:number
;resetAfter
:number
;total
:number
; };shards
:number
;url
:string
; }>
Handler to get shard count and other session info.
Returns
Promise
<{ sessionStartLimit
: { maxConcurrency
: number
; remaining
: number
; resetAfter
: number
; total
: number
; }; shards
: number
; url
: string
; }>
shardsFullPercentage
shardsFullPercentage:
number
The % of how full a shard is when resharding should be triggered.
Remarks
We use discord recommended shard value to get an approximation of the shard full percentage to compare with this value so the bot may not reshard at the exact percentage provided but may reshard when it is a bit higher than the provided percentage.
For accurate calculation, you may override the checkIfReshardingIsNeeded
function
Default
80 as in 80%
updateGuildsShardId()?
optional
updateGuildsShardId: (guildIds
,shardId
) =>Promise
<void
>
Handler to edit the shard id on any cached guilds.
Parameters
guildIds
string
[]
shardId
number
Returns
Promise
<void
>
shardsPerWorker?
optional
shardsPerWorker:number
Defined in: gateway/src/manager.ts:607
The amount of shards to load per worker.
Default
25
spawnShardDelay?
optional
spawnShardDelay:number
Defined in: gateway/src/manager.ts:592
Delay in milliseconds to wait before spawning next shard. OPTIMAL IS ABOVE 5100. YOU DON'T WANT TO HIT THE RATE LIMIT!!!
Default
5300
spreadShardsInRoundRobin?
optional
spreadShardsInRoundRobin:boolean
Defined in: gateway/src/manager.ts:625
Whether to spread shards across workers in a round-robin manner.
Remarks
By default, shards are assigned to workers in contiguous blocks based on shardsPerWorker. If any shard is left over, it will be assigned to the last worker. This means that if you have 3 workers and 40 shards while shardsPerWorker is 10, the first worker will get shards 0-9, the second worker will get shards 10-19, and so on, the last worker will get shards 20-39.
If this option is set to true, the shards will be assigned in a round-robin manner to spread more evenly across workers. For example, with 3 workers and 40 shards, the first shard will go to worker 0, the second shard to worker 1, the third shard to worker 2, the fourth shard to worker 0, and so on.
Default
false
token
token:
string
Defined in: gateway/src/manager.ts:659
Bot token which is used to connect to Discord
totalShards?
optional
totalShards:number
Defined in: gateway/src/manager.ts:602
Total amount of shards your bot uses. Useful for zero-downtime updates or resharding.
Default
1
totalWorkers?
optional
totalWorkers:number
Defined in: gateway/src/manager.ts:612
The total amount of workers to use for your bot.
Default
4
transportCompression?
optional
transportCompression:null
|TransportCompression
Defined in: gateway/src/manager.ts:634
What transport compression should be used
url?
optional
url:string
Defined in: gateway/src/manager.ts:664
The URL of the gateway which should be connected to.
Default
"wss://gateway.discord.gg"
version?
optional
version:number
Defined in: gateway/src/manager.ts:669
The gateway version which should be used.
Default
10