dressed
Version:
A sleek, serverless-ready Discord bot framework.
38 lines (37 loc) • 1.1 kB
TypeScript
import type { RawFile } from "../types/file.ts";
import { botEnv } from "./env.ts";
/** Optional extra config for the layer before fetch */
export interface CallConfig {
/**
* The authorization string to use
* @default `Bot {env.DISCORD_TOKEN}`
*/
authorization?: string;
/**
* Number of retries when rate limited before the caller gives up
* @default 3
*/
tries?: number;
/**
* The location which endpoints branch off from
* @default "https://discord.com/api/v10"
*/
routeBase?: string;
/**
* Environment variables to use
* @default {botEnv}
*/
env?: Partial<typeof botEnv>;
/**
* Delay in seconds before old ratelimit buckets are purged from the cache, set to -1 to disable
* @default 1,800 // 30 minutes
*/
bucketTTL?: number;
}
export declare function callDiscord(endpoint: string, init: Omit<RequestInit, "body"> & {
method: string;
params?: unknown;
body?: unknown;
files?: RawFile[];
flattenBodyInForm?: boolean;
}, $req?: CallConfig): Promise<Response>;