If you don't already have Node.js:
-
Go to: https://nodejs.org
-
Install it using the default options.
-
After installing, open a terminal (or Command Prompt) and run:
node -v npm -v
If both show version numbers, you're ready.
-
Open a terminal inside your project folder.
-
Run:
npm install
This installs all required packages listed in
package.json. -
You must do this before running the bot.
- Go to the Discord Developer Portal:
https://discord.com/developers/applications - Click "New Application"
- Give it a name (ex: Bitcraft Job Bot)
- Click Create
- On the left sidebar, click Bot
- Click Add Bot
- Click Yes, do it!
- Now you have a Discord bot.
- In the Bot section
- Click Reset Token (if needed)
- Click Copy
IMPORTANT:
Never share this token with anyone. It gives full control over your bot.
You'll paste this into the setup script later.
- Click General Information (left sidebar)
- Copy the Application ID
- You'll need this for setup.
- Go to OAuth2 → URL Generator
- Under Scopes, check:
- bot
- applications.commands
- Under Bot Permissions, select the permissions your bot needs.
This bot only needs:- Send Messages
- Copy the generated URL at the bottom.
- Give this link to the server owner. If the owner is you - open it in your browser.
- Select your server.
- Click Authorize.
Your bot is now in your server.
To get Channel IDs and your User ID:
- Open Discord
- Go to User Settings → Advanced
- Enable Developer Mode
- Now you can right-click things and Copy their IDs.
You will need:
1. Bot Report Channel ID
- Create a new channel in the server your bot belongs to for debug messages
- Right-click the debug channel
- Click Copy ID
2. Your Discord User ID (Admin ID)
- Right-click your username (on the right sidebar of any server you belong to)
- Click Copy ID
This project includes a setup helper: setup.js
Run:
node setup.jsIt will ask you for:
- Discord Application ID
- Discord Bot Token
- Bot Report Channel ID
- Your Discord User ID
It will automatically create a .env file for you.
After setup is complete, start the bot with:
node bot.jsIf everything is correct, your bot should come online in your Discord server.
You'll see a green "Online" indicator next to it.
pm2 keeps your bot running in the background and can restart it if it crashes or after a reboot.
-
Install pm2 globally:
npm install -g pm2
-
From your project folder, start the bot with pm2:
pm2 start bot.js --name bitcraft-job-bot
-
Useful commands:
pm2 monit– live dashboard (CPU, memory, logs)pm2 status– see if the bot is runningpm2 logs bitcraft-job-bot– view logspm2 stop bitcraft-job-bot– stop the botpm2 restart bitcraft-job-bot– restart the bot
-
(Optional) Start the bot on system boot:
pm2 startup pm2 save
Bot not coming online?
- Make sure you ran
npm install - Make sure your
.envfile exists - Double-check your token
- Make sure the bot was invited to the server
Getting "Missing Access" errors?
- Check the bot permissions in the server settings
- Make sure it has permission to send messages in that channel
- Never upload your
.envfile to GitHub. - Never share your bot token.
- If you accidentally leak your token, reset it immediately in the Developer Portal.
You can adjust behavior in settings.json. Restart the bot after changing settings.
| Setting | Description |
|---|---|
| CACHE_FILE_PATH | File path for the in-memory cache backup (e.g. cache.json). |
| WRITE_CACHE_FILE | If true, the bot writes the cache to disk; if false, cache is memory-only. |
| ALL_CRAFTS_EXPIRE_SECONDS | How long (in seconds) the "all crafts" API response is cached before refetching. |
| CLAIM_MEMBERS_EXPIRE_SECONDS | How long (in seconds) claim-members data is cached before refetching. |
| NEW_CRAFTS_EXPIRE_SECONDS | How long (in seconds) "new crafts" data is cached before refetching. |
| POLL_CRAFTS_INTERVAL_SECONDS | How often (in seconds) the bot polls for new crafts and notifies subscribed channels. |
Your Discord bot should now be fully set up and running.
If you ever move the project to a new machine:
- Clone/download the project
- Run
npm install - Run
node setup.js - Start the bot with
node bot.js