PHS Rambots Discord management bot with slash commands for managing website content via GitHub.
- Node.js 18+ — https://nodejs.org
- A Discord account with a server where you have admin rights
- A GitHub Personal Access Token with
repowrite access
- Go to https://discord.com/developers/applications
- Click New Application → name it
phstoolbot - Go to the Bot tab → click Add Bot
- Under Token, click Reset Token and copy it — this is your
BOT_TOKEN - Copy the Application ID from the General Information tab — this is your
CLIENT_ID - Under Bot → Privileged Gateway Intents, enable:
- ✅ Server Members Intent (needed for guild verification)
- Under OAuth2 → URL Generator:
- Scopes:
bot,applications.commands - Bot Permissions:
Send Messages,Use Slash Commands,Embed Links - Copy the generated URL and open it to invite the bot to your server
- Scopes:
- Go to https://github.com/settings/tokens
- Click Generate new token (classic)
- Set a name like
phstoolbot - Expiration: your choice (no expiration recommended for bots)
- Select scope: ✅
repo(full control of private repositories) - Click Generate token — copy it, this is your
GITHUB_PAT
# Clone or copy the phstoolbot folder to your server/machine
cd phstoolbot
# Install dependencies
npm install
# Copy the example env file
cp .env.example .env
# Edit .env with your values
nano .env # or use any text editorFill in your .env:
BOT_TOKEN=your_discord_bot_token_here
CLIENT_ID=your_application_client_id_here
GUILD_ID=1424064165928239134
GITHUB_PAT=your_github_pat_here
GITHUB_OWNER=frc6548
GITHUB_REPO=phsrambots.orgNote: If
.envis missing or has blank values, the bot will print a warning on startup, write a template.env, and exit. Fill in the file and restart.
npm startOn first boot, you'll see:
✅ Config loaded from .env
Registering slash commands...
Slash commands registered.
Logged in as phstoolbot#XXXX
Slash commands register to the guild instantly (no wait).
Create /etc/systemd/system/phstoolbot.service:
[Unit]
Description=phstoolbot Discord Bot
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/path/to/phstoolbot
ExecStart=/usr/bin/node src/index.js
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl daemon-reload
sudo systemctl enable phstoolbot
sudo systemctl start phstoolbot
sudo systemctl status phstoolbot| Command | Description |
|---|---|
/add-event |
Add an event to the website calendar |
/remove-event |
Remove an event from the calendar by ID |
/edit-slideshow |
Interactive slideshow editor with Prev/Next/Edit/Delete/Push buttons |
Options: title, date (YYYY-MM-DD), start (HH:MM), end (HH:MM), location, description
Pushes to data/calendar/[YEAR]/[MONTH]/events.json on GitHub.
Event ID is auto-generated from the title and date.
Options: id (the event tag), year, month
Finds and removes the event with the given ID from the correct file.
Pulls up an interactive embed showing each slide with:
- ◀ Prev / Next ▶ — navigate slides
- ✏️ Edit — opens a modal to edit header, description, link, image path, and alt text
- 🗑 Delete — prompts you to type
YESto confirm deletion - ✔ Save & Push — commits and pushes all changes to GitHub
Only users inside guild 1424064165928239134 can run commands. Anyone outside sees:
❌ Permission Denied — You do not have permission to use this bot.
All commits made by the bot are prefixed with [AUTOMATED], e.g.:
[AUTOMATED] Add event "Craft Show At Village Fresh" on 2026-10-10
[AUTOMATED] Remove event "Craft Show At Village Fresh" (Craft-Show-At-Village-Fresh-2026-10-10)
[AUTOMATED] Update slideshow content