RESTOptions
export interface RESTOptions
export interface RESTOptions
Options to be passed when creating the REST instance
agent
:
Dispatcher
The agent to set globally
api
:
string
The base api path, without version
authPrefix
:
'Bot' | 'Bearer'
The authorization prefix to use for requests, useful if you want to use bearer tokens
cdn
:
string
The cdn path
globalRequestsPerSecond
:
number
How many requests to allow sending per second (Infinity for unlimited, 50 for the standard global limit used by Discord)
handlerSweepInterval
:
number
The amount of time in milliseconds that passes between each hash sweep. (defaults to 1h)
hashLifetime
:
number
The maximum amount of time a hash can exist in milliseconds without being hit with a request (defaults to 24h)
hashSweepInterval
:
number
The amount of time in milliseconds that passes between each hash sweep. (defaults to 4h)
headers
:
Record<string, string>
Additional headers to send for all API requests
invalidRequestWarningInterval
:
number
The number of invalid REST requests (those that return 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings). That is, if set to 500, warnings will be emitted at invalid request number 500, 1000, 1500, and so on.
offset
:
number
The extra offset to add to rate limits in milliseconds
Determines how rate limiting and pre-emptive throttling should be handled. When an array of strings, each element is treated as a prefix for the request route (e.g.
/channels
to match any route starting with /channels
such as /channels/:id/messages
) for which to throw RateLimitErrors. All other request routes will be queued normallyretries
:
number
The number of retries for errors with the 500 code, or errors that timeout
timeout
:
number
The time to wait in milliseconds before a request is aborted
userAgentAppendix
:
string
Extra information to add to the user agent
version
:
string
The version of the API to use