DiscordBotBoilerplate
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://redlicdev--574143f490a711f0bbf30224a6c84d84.web.val.run
A Discord bot using HTTP interactions (webhooks) instead of the Gateway API.
- HTTP-based Discord interactions using webhooks
- Hono.js web framework
- discord-interactions middleware for signature verification
- Simple
/pingslash command
- Create a Discord application at https://discord.com/developers/applications
- Get your application's public key and bot token
- Set environment variables:
DISCORD_PUBLIC_KEY: Your application's public keyDISCORD_BOT_TOKEN: Your bot token
- Register the slash commands (run the registration endpoint once)
- Set your Discord application's Interactions Endpoint URL to your Val Town HTTP endpoint
DISCORD_PUBLIC_KEY: Required for verifying Discord requestsDISCORD_BOT_TOKEN: Required for registering slash commands
POST /- Main Discord interactions endpointPOST /register-commands- Register slash commands with Discord (run once)
/ping- Simple ping command that responds with "Pong!"