Building a custom Discord bot using Discord.js gives you total control over slash commands, moderation bots, music playback, and automated community tools.
This guide will show you how to initialize your Node.js environment, install discord.js (and additional npm packages), and launch your bot using the Cubes Hosting Game Panel.
Step 1: Set Startup Parameters to Bash / Terminal Mode
To run npm commands directly on your server, first switch your startup mode to a interactive shell terminal:
- Log in to your Cubes Hosting Game Panel and select your Discord bot server.
- Navigate to Configuration > Startup Parameters on the left menu.
- Set your primary executable or startup command to
bash(or shell terminal mode). - Click Start on your server Console.
Step 2: Initialize Node.js (npm init -y)
Once your server terminal is online in the Console:
- Open the Console tab on the left menu.
- In the terminal command input bar at the bottom, type:
npm init -y - Press Enter. Node Package Manager will automatically generate a clean
package.jsonfile in your root server directory.
Step 3: Install Discord.js and NPM Packages
Now install discord.js directly into your server environment:
- In the console command bar, type:
(Or
npm install discord.jsnpm i discord.jsfor short). - Press Enter and wait a few seconds while npm downloads the Discord.js library.
Installing Additional Packages: You can install any other npm package your bot requires (such as
dotenv,@discordjs/voice,mongoose, oraxios) using the same command:npm install dotenv mongoose
Step 4: Configure Your Bot's Entry Point
Once your packages have finished installing:
- Click Stop (or Kill) to turn off your server.
- Go back to Configuration > Startup Parameters.
- Change your startup command from
bashback to Node.js:(Replacenode index.jsindex.jswith your main bot filename if it is namedbot.jsorapp.js).
Step 5: Upload Your Bot Code & Launch
- Open your Game Panel File Manager (or connect via SFTP).
- Upload your bot's
.jsfiles (likeindex.js), configuration files, and.envfile into the main root directory. - Open your Console and click Start!
Your Discord.js bot will boot up, connect to Discord's gateway API, and shine online in your Discord server!
Related Guides
Conclusion
Installing discord.js on Cubes Hosting takes less than two minutes. Initialize Node with npm init -y, install discord.js via the console, upload your code, and watch your bot come to life!
