Skip to content

DiscordBotClientOptions

Defined in: bot/bot.type.ts:2

Options for createDiscordBotClient.

optional baseUrl?: string

Defined in: bot/bot.type.ts:9

Override base URL for testing. Defaults to https://discord.com/api/v10. The bot token is sent to whatever host this names, so never derive it from untrusted input.


botToken: string

Defined in: bot/bot.type.ts:4

Bot token from the Discord developer portal (Bot → Reset Token).


optional fetch?: (input, init?) => Promise<Response>

Defined in: bot/bot.type.ts:11

Override fetch for testing. Defaults to globalThis.fetch.

string | URL | Request

RequestInit

Promise<Response>


optional maxRetries?: number

Defined in: bot/bot.type.ts:18

Retries after a 429 (rate limit) before giving up. Defaults to 3. Each retry waits for the Retry-After Discord sends; a wait longer than 10 seconds fails immediately.


optional sleep?: (ms) => Promise<void>

Defined in: bot/bot.type.ts:20

Wait between rate-limit retries; a test seam. Defaults to setTimeout.

number

Promise<void>


optional timeoutMs?: number

Defined in: bot/bot.type.ts:13

Per-request deadline in milliseconds. Defaults to 15000.