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.
Parameters
Section titled “Parameters”config
Section titled “config”What the bot answers.
Returns
Section titled “Returns”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.
Example
Section titled “Example”import { bot, command } from 'botflare';
export default bot({ commands: [command({ name: 'ping', description: 'Pong' }, (c) => c.reply('pong'))] });