State-driven framework for Discord bots using HTTP Interactions API
npm install discord-flowbash
npm install discord-flow
`
Quick Start
`typescript
import { registry, createServer } from 'discord-flow';
const engine = registry.create();
registry.define('bot', (flow) => {
flow.start('idle');
flow.state('idle')
.on.command({
name: 'ping',
description: 'Pong!'
}, () => ({
response: { content: 'Pong! 🏓' }
}));
});
createServer({
publicKey: process.env.DISCORD_PUBLIC_KEY!,
token: process.env.DISCORD_TOKEN!,
engine
}).start();
`
Packages
This is a monorepo containing:
- discord-flow - Main package (this one)
- @discord-flow/core - Core flow engine
- @discord-flow/types - TypeScript types
- @discord-flow/store - State store
- @discord-flow/adapter-discord-http - HTTP adapter
- @discord-flow/multibots` - Multi-bot server support