Discord bots
Discord bots in Python (discord.py) or Node.js (discord.js), what to put in the request, how to test-run a bot inside Codexe, runtime limits per plan, and keeping the token safe.
Updated
On this page
Codexe generates complete Discord bot projects in Python (discord.py) or Node.js (discord.js), using slash commands.
#What to put in the request
- Library (Python or Node.js).
- Each slash command with its options and who may use it.
- Events to react to (member joins, messages, reactions).
- Storage (JSON, SQLite…) and any external APIs.
- Which intents you're willing to enable. Message Content and Server Members are privileged and must be switched on in the Discord developer portal.
#The token
Generated bots read the token from the DISCORD_TOKEN environment variable (BOT_TOKEN or TOKEN also work). It's never written into the source, and no .env file is generated. Treat the token like a password: if it leaks, reset it in the Discord developer portal.
#Test-running a bot in Codexe
Bot projects have a Host panel for trying the bot without setting up a server. Paste your bot token (stored encrypted, and you can delete it), then Start, Stop, Restart and watch the Console.
This is a test environment, not permanent hosting:
| Plan | Runtime per rolling 24 hours |
|---|---|
| Free | 15 minutes |
| Pro | 4 hours |
| Business | 12 hours |
| Enterprise | 24 hours |
On every plan: a session stops after 30 minutes, one bot runs at a time per account, and starts are rate-limited. Bots run isolated, with internet access but no access to Codexe's own systems.
#Verification
Discord bots aren't build-verified. Ready means the generation finished (see the project lifecycle). Use the test run to check them.
#Running it yourself
Download the ZIP, install the dependencies (pip install -r requirements.txt or npm install), set DISCORD_TOKEN in your environment and start it. Invite the bot to your server with the bot and applications.commands scopes.
#Common issues
| Symptom | Likely cause |
|---|---|
| Slash commands don't appear | Commands not synced yet. Global sync can take up to an hour; guild sync is instant. |
| Bot is online but ignores messages | A privileged intent isn't enabled in the developer portal. |
| "The application did not respond" | The command took over 3 seconds without deferring. Ask the chat to defer the response. |