How ckt1031/discord-captcha-bot works
Project type and purpose
• This is a backend-focused, containerized Node.js/Express web application that provides a CAPTCHA verification flow for new members of a Discord server.
• It serves static HTML pages for the user’s browser, integrates with external CAPTCHA providers (reCAPTCHA, hCaptcha, Cloudflare Turnstile), and uses the Discord API (via discord.js) to assign roles.
File structure
• Top level
• Dockerfile, .dockerignore, GitHub Actions workflows → container build and CI/CD
• env example, validate-env.ts → environment variable management
• package.json, tsconfig.json, eslint.config.mjs → Node.js/TypeScript build and linting
• html/ directory → static pages (captcha, success, error, verified)
• assets/ directory → static assets (CSS, images, scripts)
• src/
• index.ts → entry point, wraps server
• server.ts → Express app setup, route definitions, middleware
• validate-env.ts → loads and verifies required environment variables
• type.d.ts → shared TypeScript types
• No database; state is ephemeral. Interactions are limited to CAPTCHA provider APIs and Discord’s REST API.
README for additional insights
• The service exposes a /verify endpoint to present and process CAPTCHA challenges.
• On success, the bot assigns a “Verified” role and sends a DM via Discord.js.
• Docker can run the app; environment variables configure ports, credentials, callback URL.
Elements
• “User Browser”
• “Docker Container” with sub-components: Env Loader, Express App, Static HTML/Assets
• “CAPTCHA Provider API”
• “Discord API”
• HTTP requests/responses between Browser ↔ Express
• API calls Express → CAPTCHA Provider
• API calls Express → Discord
Final advice
• Every integration point (env loader, Discord role assignment, DM sending).