discord-flow
v1.1.2
Published
State-driven framework for Discord bots using HTTP Interactions API
Maintainers
Readme
discord-flow
State-driven framework for Discord bots using HTTP Interactions API.
Features
- 🚀 HTTP-only - No WebSocket Gateway, just HTTP interactions
- 🎯 State Machine - Define flows as state machines
- 📦 ~30MB RAM - Minimal memory footprint
- 🔧 TypeScript - Fully typed
- ⚡ Fast - Optimized for serverless environments
Installation
npm install discord-flowQuick Start
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
License
MIT
