Prerequisites
Before installing the bot, ensure you have the following:Node.js
Version 18.0.0 or higher
Discord bot token
From Discord Developer Portal
Create a Discord bot
If you haven’t created a Discord bot yet:Visit Discord Developer Portal
Go to discord.com/developers/applications and click “New Application”
Create bot user
Navigate to the “Bot” section and click “Add Bot”. Confirm by clicking “Yes, do it!”
Enable required intents
Scroll down to “Privileged Gateway Intents” and enable:
GuildsGuildMessages
Installation steps
Install dependencies
Install the required Node.js packages:This will install the following core dependencies:
discord.js(v14.14.1+) - Discord API wrapperdotenv(v16.3.1+) - Environment variable management
Configure environment variables
Copy the example environment file:Edit
.env and add your Discord credentials:See the Configuration page for detailed information about environment variables.
Deploy slash commands
Register the bot’s slash commands with Discord:
For instant command deployment during development, add a
GUILD_ID to your .env file. Without it, global deployment takes up to 1 hour to propagate.Development mode
For development, use these additional commands:Verify installation
Once the bot is running, verify it works:Test ping command
Type
/ping in any channel the bot has access to. You should receive a response with the bot’s latencyIf commands don’t appear, wait a few minutes for Discord to register them, or restart your Discord client.
Troubleshooting
Bot doesn’t respond to commands
- Verify the bot has the required permissions in your server
- Check that slash commands were deployed with
npm run deploy - Ensure the bot token and client ID in
.envare correct - Try restarting your Discord client to refresh the command cache
”DISCORD_TOKEN is not set” error
The bot validates environment variables on startup. Fromsrc/index.ts:
.env file exists and contains a valid DISCORD_TOKEN.
Module not found errors
If you see module resolution errors:Next steps
Configuration
Learn about environment variables and bot permissions
Usage guide
Discover how to use all bot commands effectively