This guide will walk you through the steps to set up your Discord bot from scratch. Follow each step carefully to ensure everything is set up correctly. I made this README with ChatGPT, not too sure how reliable it is, and I'm too lazy to make my own.
This bot was made for discord.gg/bzms but is no longer being hosted, so I'm making it open-sourced.
There are more cool commands, but I'm too lazy to upload more images, you can find old usage of the bot at discord.gg/bzms.
- Go to the Discord Developer Portal.
- Click on "New Application" and give your bot a name.
- Navigate to the "Bot" tab and click "Add Bot".
- Under "TOKEN", click "Copy". Keep this token safe as you'll need it later.
- Note down the
clientId
from the "General Information" tab.
- Download the bot's code from the provided repository or source.
- Extract the downloaded zip file to a location of your choice.
- Download and install Visual Studio Code (VS Code).
- Download and install Node.js, which includes npm (Node Package Manager).
- Open VS Code.
- Click on "File" -> "Open Folder..." and navigate to the folder where you extracted the bot's code.
- Open the folder.
- Go to MongoDB Atlas and sign up or log in.
- Create a new cluster and database.
- Make sure to create a user with the correct permissions and get the connection string. You'll need this for your bot's configuration.
- In the VS Code explorer, find the
config.json
file and open it. - Fill out the following details:
{ "botToken": "YOUR_DISCORD_BOT_TOKEN", "mongoUri": "YOUR_MONGODB_CONNECTION_STRING", "guildId": "YOUR_DISCORD_GUILD_ID", "clientId": "YOUR_DISCORD_CLIENT_ID", "manipulationChannel": "CHANNEL_ID_FOR_MANIPULATION_NOTIFICATIONS", "onlineStatusChannel": "CHANNEL_ID_FOR_ONLINE_STATUS_NOTIFICATIONS", "hypixelApiKey": "YOUR_HYPIXEL_API_KEY" }
botToken
: Your Discord bot token from the Developer Portal.mongoUri
: Your MongoDB connection string.guildId
: Your Discord server (guild) ID.clientId
: Your Discord bot client ID.manipulationChannel
: The ID of the channel for manipulation notifications.onlineStatusChannel
: The ID of the channel for online status notifications.hypixelApiKey
: Your Hypixel API key.
- Save the file.
- Open a terminal in VS Code by clicking "Terminal" -> "New Terminal".
- Run
npm install
to install all necessary dependencies. - Once the dependencies are installed, run the bot with the command
node .
.
- Go back to the Discord Developer Portal.
- Navigate to the "OAuth2" tab.
- Under "OAuth2 URL Generator", select
bot
andapplications.commands
in the scopes section. - In the "Bot Permissions" section, select the necessary permissions your bot needs.
- Copy the generated URL, paste it into your browser, and invite the bot to your server.
Instead of hardcoding sensitive information in config.json
, consider using environment variables. Create a .env
file in your project root and add the following: