@discord-flow/adapter-discord-http
v1.0.4
Published
HTTP adapter for Discord Interactions API
Maintainers
Readme
@discord-flow/adapter-discord-http
HTTP adapter for discord-flow. Handles Discord interactions via HTTP.
Installation
npm install @discord-flow/adapter-discord-httpUsage
import { createServer } from '@discord-flow/adapter-discord-http';
const server = createServer({
publicKey: process.env.DISCORD_PUBLIC_KEY!,
token: process.env.DISCORD_TOKEN!,
engine
});
server.start(); // Starts on port 3000API
createServer(options)
Creates an HTTP server for Discord interactions.
Options
publicKey- Discord application public key (for signature verification)token- Discord bot tokenengine- Flow engine instanceport- Server port (default: 3000)
server.start()
Starts the HTTP server.
server.stop()
Stops the HTTP server.
REST API Client
import { DiscordAPI } from '@discord-flow/adapter-discord-http';
const api = new DiscordAPI(token);
// Send a message
await api.channels.createMessage(channelId, { content: 'Hello!' });
// Create a role
await api.guilds.createRole(guildId, { name: 'New Role' });License
MIT
