CreateGatewayManagerOptions
@discordeno/gateway • Docs
Documentation / @discordeno/gateway / CreateGatewayManagerOptions
Interface: CreateGatewayManagerOptions
Properties
cache?
optional
cache:object
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
Defined in
compress?
optional
compress:boolean
Whether incoming payloads are compressed using zlib.
Default
false
Defined in
connection?
optional
connection:object
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
Defined in
events?
optional
events:ShardEvents
The events handlers
Defined in
firstShardId?
optional
firstShardId:number
Id of the first Shard which should get controlled by this manager.
Default
0
Defined in
intents?
optional
intents:number
The calculated intent value of the events which the shard should receive.
Default
0
Defined in
lastShardId?
optional
lastShardId:number
Id of the last Shard which should get controlled by this manager.
Default
0
Defined in
logger?
optional
logger:Pick
<object
,"debug"
|"info"
|"warn"
|"error"
|"fatal"
>
The logger that the gateway manager will use.
Type declaration
debug()
debug: (...
args
) =>void
Parameters
• ...args: any
[]
Returns
void
error()
error: (...
args
) =>void
Parameters
• ...args: any
[]
Returns
void
fatal()
fatal: (...
args
) =>void
Parameters
• ...args: any
[]
Returns
void
info()
info: (...
args
) =>void
Parameters
• ...args: any
[]
Returns
void
log()
log: (
level
, ...args
) =>void
Parameters
• level: LogLevels
• ...args: any
[]
Returns
void
setDepth()
setDepth: (
level
) =>void
Parameters
• level: LogDepth
Returns
void
setLevel()
setLevel: (
level
) =>void
Parameters
• level: LogLevels
Returns
void
warn()
warn: (...
args
) =>void
Parameters
• ...args: any
[]
Returns
void
Default
logger // The logger exported by @discordeno/utils
Defined in
makePresence()?
optional
makePresence: () =>Promise
<undefined
|BotStatusUpdate
>
Make the presence for when the bot connects to the gateway
Returns
Promise
<undefined
| BotStatusUpdate
>
Remarks
This function will be called each time a Shard is going to identify
Defined in
preferSnakeCase?
optional
preferSnakeCase:boolean
Whether to send the discord packets in snake case form.
Default
false
Defined in
properties?
optional
properties:object
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"
Defined in
resharding?
optional
resharding:object
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
<object
>
Handler to get shard count and other session info.
Returns
Promise
<object
>
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
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
>
Defined in
shardsPerWorker?
optional
shardsPerWorker:number
The amount of shards to load per worker.
Default
25
Defined in
spawnShardDelay?
optional
spawnShardDelay:number
Delay in milliseconds to wait before spawning next shard. OPTIMAL IS ABOVE 5100. YOU DON'T WANT TO HIT THE RATE LIMIT!!!
Default
5300
Defined in
token
token:
string
Bot token which is used to connect to Discord
Defined in
totalShards?
optional
totalShards:number
Total amount of shards your bot uses. Useful for zero-downtime updates or resharding.
Default
1
Defined in
totalWorkers?
optional
totalWorkers:number
The total amount of workers to use for your bot.
Default
4
Defined in
transportCompression?
optional
transportCompression:null
|TransportCompression
What transport compression should be used
Defined in
url?
optional
url:string
The URL of the gateway which should be connected to.
Default
"wss://gateway.discord.gg"
Defined in
version?
optional
version:number
The gateway version which should be used.
Default
10