Skip to content

bot

bot(config): Bot

Defined in: bot.ts:107

Creates a Worker handler for the Interactions Endpoint URL of a Discord application. It rejects requests without a valid Ed25519 signature, answers Discord’s PING check and runs the matching command. It reads DISCORD_PUBLIC_KEY from the Worker environment: the hex public key of your application in the Discord Developer Portal.

BotConfig

What the bot answers.

Bot

The Worker handler. Export it as the default export of your Worker. Pass it to gateway({ bot }) to answer interactions that arrive over the gateway too.

import { bot, command } from 'botflare';
export default bot({ commands: [command({ name: 'ping', description: 'Pong' }, (c) => c.reply('pong'))] });