Credentials
Configure Discord authentication
Your bot needs a token and client ID to connect to Discord. These values are stored in a .env file that Robo.js loads automatically at startup.
Required Variables
| Variable | Description |
|---|---|
DISCORD_TOKEN | Bot authentication token |
DISCORD_CLIENT_ID | Application ID |
Create an Application
If you don't have an application yet:
- Open discord.com/developers/applications and sign in.
- Click New Application, give it a name, and confirm.
Discord automatically creates a bot user for the application — no separate step is needed.
Discord Developer Portal Applications page showing the New Application button in the top right corner, with the applications list visible below
Bot Token
Obtain the token from the Discord Developer Portal:
- Open discord.com/developers/applications and sign in.
- Select your application.
- Navigate to the Bot tab.
- Click Reset Token and copy the value.
The token is shown only once. Store it immediately in your .env file.
Discord Developer Portal Bot tab with the token section visible, showing the Reset Token button and Copy button, with the Privileged Gateway Intents section partially visible below
Add it to your .env file:
# .env
DISCORD_TOKEN="your_bot_token"Client ID
Find the application ID in the portal:
- Select your application.
- Navigate to General Information.
- Copy the Application ID.
The DISCORD_CLIENT_ID is the same as the Application ID shown in the Developer Portal. Discord uses "Application ID" and "Client ID" interchangeably.
Add it to your .env file:
# .env
DISCORD_CLIENT_ID="your_application_id"Optional Variables
| Variable | Description |
|---|---|
DISCORD_GUILD_ID | Test server ID for scoped command registration. Commands deploy only to this server during development, which is faster than global registration. |
DISCORD_DEBUG_CHANNEL_ID | Channel ID for forwarding background errors. Async errors are sent to this channel instead of failing silently. |
Developer Mode
Enable Developer Mode in Discord to copy IDs for servers, channels, and users:
- Open Discord and go to User Settings.
- Navigate to Advanced.
- Toggle Developer Mode on.
With Developer Mode enabled, right-click any server, channel, or user to copy its ID.
Discord user settings Advanced page with the Developer Mode toggle switch turned on, showing the setting description explaining that Developer Mode enables Copy ID in context menus
Security
Never commit your .env file to version control. Robo.js includes .env in .gitignore by default when scaffolding a project.
If you accidentally expose your token, regenerate it immediately in the Discord Developer Portal under the Bot tab.
