-
Notifications
You must be signed in to change notification settings - Fork 144
Client options
SinisterRectus edited this page Jan 16, 2023
·
12 revisions
When initializing a client, a table of options can be passed to the constructor. A variety of sanity checks are performed on client initialization and while authenticating. Invalid options will result in an error being thrown while unusual options may log a client warning.
An example of using client options:
local discordia = require('discordia')
local client = discordia.Client {
logFile = 'mybot.log',
cacheAllMembers = true,
}
The options table and the fields in it are all optional. Accepted fields are:
Option | Default | Description |
---|---|---|
routeDelay | 300 | Minimum time in milliseconds to wait between HTTP requests per-route |
maxRetries | 5 | The maximum number of retries to attempt after an HTTP request fails |
shardCount | 0 | The total number of shards the application is using (0 signals to use the recommended count) |
firstShard | 0 | The ID of the first shard to run on the client (0 is the minimum) |
lastShard | -1 | The ID of the last shard to run on the client (-1 signals to use shardCount - 1 ) |
largeThreshold | 100 | Limit to how many members are initially fetched per-guild on start-up |
cacheAllMembers | false | Whether to cache all members (If false, offline members may not be cached) |
autoReconnect | true | Whether to attempt to reconnect after an unexpected gateway disconnection |
compress | true | Whether to allow for compressed gateway payloads |
bitrate | 64000 | The default bitrate to use for voice connections, from 8000 to 128000 |
logFile | 'discordia.log' | The file to use for logging |
logLevel | logLevel.info | The level to use for logging (see Enumerations) |
dateTime | '%F %T' | The date and time format to use logging |
syncGuilds | false | Whether to automatically sync all guilds on start up (user-accounts only) |
gatewayIntents | 3243773 | Represents which intents to use. The default includes all non-privileged intents |