Use discord.js v14 with Claude Code to scaffold a bot, register slash commands via the Discord Developer Portal, and deploy to a free-tier Railway or self-hosted VPS. AI handles event handlers, intent configuration, and command routing.
pnpm add discord.js dotenv.deploy-commands.js. Ask AI: "Generate a script that registers slash commands globally via Discord REST API using CLIENT_ID and GUILD_ID from env."/ask command, route to an AI provider through your backend (never hardcode API keys). Stream responses if over 2000 characters — split into multiple messages.process.env.DISCORD_TOKEN is set. Bot auto-reconnects on restart.bot + applications.commands scopes → minimum permissions → paste URL in browser..env to .gitignore before first commit. If leaked, regenerate immediately.| Tool | Best For | Price |
|---|---|---|
| discord.js | Node.js library | Free |
| Discord.py | Python alternative | Free |
| Railway | Free-tier hosting | $0-5/mo |
| Fly.io | Edge deployment | Free tier |
| PM2 | Process manager on VPS | Free |
Q: Does my bot need to be verified? Only at 100+ servers. Below that, no verification required.
Q: Can the bot respond to DMs?
Yes — listen for Events.MessageCreate with channel.type === ChannelType.DM.
Q: How do I add buttons and modals?
Use ActionRowBuilder with ButtonBuilder and ModalBuilder — ask AI for the exact discord.js v14 syntax.
Q: What's the best free host? Railway free tier or a $5/mo Hetzner VPS for unlimited uptime.
Q: Can I store user data? Yes — use Supabase (self-hosted free), SQLite, or Redis. Keep Discord IDs as your primary key.
Q: How do I test without spamming my real server? Create a test server and use guild-scoped commands for instant updates.
Discord bots are the fastest feedback loop in bot dev. Scaffold with AI, deploy to free hosting, and watch your command usage metrics. Start simple — one useful command beats ten half-working ones.
Free newsletter
Join thousands of creators and builders. One email a week — practical AI tips, platform updates, and curated reads.
No spam · Unsubscribe anytime
Cursor editor lagging, freezing, or using 100% CPU? Complete 2026 guide to fix Cursor performance issues.
GitHub Copilot stopped giving suggestions in VS Code or JetBrains? Complete troubleshooting guide with 12 fixes for Copi…
Ship a paid SaaS MVP in 48 hours using Next.js, Supabase, Stripe, and AI pair programming — from zero to first paying cu…
Comments
Sign in to join the conversation
No comments yet. Be the first to share your thoughts!