OpenDomains Discord interface built with discord.js.
- Node.js 18.17+ and npm.
- A Discord application with a bot token.
- Copy
.env.exampleto.envand fill inDISCORD_TOKEN,CLIENT_ID, and optionallyGUILD_IDfor guild-scoped development commands. - Install dependencies:
npm install
- Register slash commands (guild registration is faster for iteration):
npm run register
- Run the bot:
npm start
- Copy
.env.exampleto.envand fill in the Discord values. For the bundled MongoDB service, use:MONGO_URI=mongodb://mongo:27017/open_domains_bot
- Build the image:
docker compose build
- Register slash commands:
docker compose run --rm bot npm run register
- Start the bot and MongoDB:
docker compose up -d
- View logs:
docker compose logs -f bot
/ping– health check for the bot./about– quick context on the OpenDomains bot./login– start device-based authentication with OpenDomains and store the session in MongoDB./logout– clear your stored OpenDomains session/API key./domains– show your Open Domains account stats, or passdomainto list DNS records./check– check whether a subdomain label is available./request-subdomain– submit a new subdomain request for review.
- MongoDB connection string in
MONGO_URI(and optionalMONGO_DB_NAMEoverride). - The API defaults to
https://api.open-domains.net, with device auth at/deviceAuthand the public API at/. - Device auth uses
POST /deviceAuthwithaction=request_codeandaction=poll. Authenticated API calls useAuthorization: Bearer <api_key>. - Override with
OPEN_DOMAINS_API_BASE,OPEN_DOMAINS_DEVICE_AUTH_PATH, orOPEN_DOMAINS_PUBLIC_API_PATHif the service uses different paths. - For offline testing, set
OPEN_DOMAINS_MOCK_DEVICE_AUTH=trueto return dummy device codes and a mock API key without calling the real service.
Add new commands by creating files in src/commands/ that export command = { data, execute }. Commands are auto-loaded by both the runtime and the registration script.