This guide covers how to set up and run Discord bots provided by Nexus Development. All bots are built with Node.js and require a hosting environment to stay online 24/7.
Requirements
- Node.js 18+ installed on your server
- A Discord Bot Token from the Discord Developer Portal
- npm or yarn package manager
- A process manager like PM2 (recommended) or screen
- Git (optional, for cloning repositories)
Step 1 — Download the Bot
After purchase, download the bot files from your BuiltByBit account or the delivery DM. Extract the ZIP to a folder on your server.
Step 2 — Install Dependencies
Open a terminal in the bot folder and run:
npm install
This installs all required packages listed in package.json.
Step 3 — Configure the Bot
Create a .env file in the bot root (or edit config.json depending on the bot):
| Variable | Description |
|---|---|
TOKEN | Your Discord bot token |
CLIENT_ID | Your bot's application ID |
GUILD_ID | Your Discord server ID (for slash command testing) |
PREFIX | Command prefix for message-based commands |
MONGO_URI | MongoDB connection string (if the bot uses a database) |
Step 4 — Register Slash Commands
Run the deploy command once to register commands with Discord:
node deploy-commands.js
This only needs to be done when commands change, not on every restart.
Step 5 — Start the Bot
For testing:
node index.js
For production (runs in background, auto-restarts on crash):
npm install -g pm2
pm2 start index.js --name "nexus-bot"
pm2 save
pm2 startup
Step 6 — Invite the Bot
In the Discord Developer Portal, go to OAuth2 > URL Generator:
- Scopes:
bot,applications.commands - Permissions: Select the permissions your bot needs (usually Administrator for full functionality)
- Copy the generated URL and open it in your browser to invite the bot to your server
Updating the Bot
To update to a new version:
- Back up your
.envorconfig.json - Replace the bot files with the new version
- Run
npm installto update dependencies - Run
node deploy-commands.jsif commands changed - Restart with
pm2 restart nexus-bot
NEXUS for 15% off your first purchase at ReviveNode. Their VPS plans work great for Discord bots..env file or token to Git. Add .env to your .gitignore if using version control. Exposed tokens are automatically scanned and disabled by Discord.