@deploybaseline/discord
v0.14.0
Published
Discord emulator for local development and tests: the Bot REST API v10, the Gateway over WebSocket with intents, RESUME, and sharding, interactions with callbacks, followups, and Ed25519 signed HTTP delivery, OAuth2 with bot installs, per-route rate limit
Downloads
218
Readme
@deploybaseline/discord
Discord emulator for local development and tests: the Bot REST API v10, the Gateway over WebSocket with intents, RESUME, and sharding, interactions with callbacks, followups, and Ed25519 signed HTTP delivery, OAuth2 with bot installs, per-route rate limits, and simulate endpoints for user messages and slash commands.
Part of Baseline: local drop-in replacement services for CI and no-network sandboxes.
Usage
npx -p @deploybaseline/cli -p @deploybaseline/ws baseline start --service discordThe Gateway is a WebSocket, so the opt-in @deploybaseline/ws package must be installed next to the CLI. Without it the REST API still works.
Discord starts only when named in config or with --service. In tests, start it from code:
import { createEmulator } from "@deploybaseline/cli";
import { Client, GatewayIntentBits } from "discord.js";
const discord = await createEmulator({ service: "discord" });
const client = new Client({ intents: [GatewayIntentBits.Guilds], rest: { api: `${discord.url}/api` } });
await client.login("MTAwMDAwMDAwMDAwMDAwMDEx.baseline.discord-bot-token");
await discord.close();Documentation
- Discord docs: default fixtures, auth, REST routes, Gateway, interactions, simulate endpoints, OAuth2, rate limits, seed config, and limits
- API reference:
http://localhost:3999/docs/discordwhile the CLI runs (how it works)
License
Apache-2.0
