Skip to content

MSK-Scripts/discord_multibot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
msk_multi_bot_banner

Discord Multi-Bot

A modular Discord bot system built with discord.js v14, running three independent bots in a single Node.js process.

Version License: AGPL-3.0 Node.js Discord.js Documentation

πŸ“„ Readme (EN) Β· Readme (DE)


Overview

Bot Purpose
Commands Bot Server management slash commands: rules, roles, information, orders, support, admin tools, utility
Events Bot Guild event logging, context menus, automated message handling
Minigames Bot 12 interactive minigames with a shared points & reward system

All three bots run in parallel. If one crashes, it automatically restarts after 10 seconds without affecting the others.


Requirements

  • Node.js >= 18 (built-in fetch required for the Trivia API)
  • npm
  • A Discord application with three bot tokens (one per bot)
  • A Discord server (guild) with the required roles and channels configured

Installation

# 1. Clone the repository
git clone https://github.com/MSK-Scripts/discord-multibot-js.git
cd discord-multibot-js

# 2. Install dependencies
npm install

# 3. Configure environment variables
cp .env.example .env
# β†’ Fill in your tokens, IDs and database credentials in .env

# 4. Start all bots
node main.js

Deployment (Linux / Debian)

systemd Service

A ready-to-use systemd unit file is included at multibot-js.service.

1. Adjust the paths and user in the file if necessary (default: user deploy, path /home/deploy/discord_multibot_js).

2. Copy the service file to systemd:

sudo cp multibot-js.service /etc/systemd/system/

3. Reload systemd and enable the service:

sudo systemctl daemon-reload
sudo systemctl enable multibot-js
sudo systemctl start multibot-js

4. Check the status:

sudo systemctl status multibot-js

Useful commands:

# View live logs
journalctl -u multibot-js -f

# Restart after update
sudo systemctl restart multibot-js

# Stop the bots
sudo systemctl stop multibot-js

Note: The service reads the .env file via EnvironmentFile=. Make sure the file exists at the configured path and is readable by the service user.


Configuration

All configuration is done via a .env file in the root directory. Copy .env.example and fill in the values.

Required

COMMANDS_BOT_TOKEN=your_commands_bot_token
EVENTS_BOT_TOKEN=your_events_bot_token
MINIGAMES_BOT_TOKEN=your_minigames_bot_token
GUILD_ID=your_guild_id

Optional (fall back to hardcoded MSK Scripts defaults)

# Logging & channels
LOG_CHANNEL_ID=
FEEDBACK_CHANNEL_ID=
MEMBER_COUNT_CHANNEL_ID=

# Role IDs
MEMBER_ROLE_ID=
TEAM_ROLE_ID=
GIVEAWAY_NOTIFY_ROLE_ID=
GARAGE_ROLE_ID=
HANDCUFFS_ROLE_ID=
STORAGE_ROLE_ID=
VEHICLEKEYS_ROLE_ID=

# Database (for /backup_database)
DB_HOST=localhost
DB_USER=
DB_PASS=
DB_NAME=es_extended

Features

Commands Bot

Command Description Role-restricted
/information Posts a branded server information embed βœ… Manager / Founder
/rules Posts the server rules with Verification & Giveaway Notify buttons βœ… Manager / Founder
/roles Posts script update notification role buttons βœ… Manager / Founder
/script_guides Links to documentation for a chosen script βœ… Support+
/donation Displays donation options with payment links βœ… Manager / Founder
/order_terms Sends the terms of service PDF with Accept / Reject buttons βœ… Developer / Manager / Founder
/order_price Shows an order price with Accept / Reject buttons βœ… Developer / Manager / Founder
/send_message Sends a custom message to any channel via modal βœ… Manager / Founder
/send_embed Sends a fully customizable embed to any channel βœ… Manager / Founder
/backup_database Creates a MySQL database backup and uploads it to the log channel βœ… Founder
/ping Shows bot latency and API response time β€”
/userinfo Shows info and minigame points for a user β€”
/clear Bulk-deletes up to 100 messages βœ… Team
/random Picks a random number in a given range (for guess games) βœ… Team
/rg Guess the currently active secret number β€”
/flachwitz Posts a random flat joke from the local collection β€”
/add_flachwitz Adds a new joke to the collection βœ… Team

Persistent role-toggle buttons (survive bot restarts):

  • βœ… Verification β€” assigns the Member role
  • 🎁 Giveaway Notify β€” toggles the Giveaway notification role
  • ⏰ Garage / Handcuffs / Storage / Vehicle Keys β€” toggles script update notification roles

Events Bot

Guild logging β€” All events are posted as colored embeds to the configured log channel:

Category Events logged
Members Join, Leave, Kick, Ban, Unban, Timeout set/removed
Roles Role Added (incl. added by), Role Removed (incl. removed by)
Username / Nickname Username changed, Nickname changed
Messages Edited, Deleted (incl. deleted by), Bulk delete (incl. deleted by)
Channels Created, Deleted, Updated (name, topic, slowmode, NSFW)
Roles Created, Deleted, Updated (name, color, permissions diff)
Voice Joined, Left, Moved, Server Muted/Unmuted, Server Deafened/Undeafened
Invites Created (with max uses & expiry), Deleted
  • Auto-reply β€” Automatically responds when non-team members mention "Musiker15"
  • Feedback embed β€” Messages posted in the feedback channel are auto-converted to branded embeds and the original is deleted
  • Context menus (right-click on messages):
    • πŸ“ Comment Feedback β€” Adds a moderator comment to a feedback embed and DMs the author
    • πŸ’¬ Answer a Message β€” Sends a reply to any message via modal
    • ✏️ Edit Message β€” Edits a bot message via modal
    • πŸ–ΌοΈ Edit Embed β€” Edits a bot embed (title, description, thumbnail, image, footer) via modal

Minigames Bot

All minigames are session-based (no global state) and award or deduct points on each outcome.

Command Description
/8ball Magic 8-Ball β€” asks a yes/no question
/dice Roll a die β€” d4 to d100, 1–10 dice
/flipcoin Flip a coin β€” Heads or Tails
/rps Rock Paper Scissors vs. the bot
/slots Slot machine with animated spin and 7 symbol tiers
/trivia Multiple-choice trivia (OpenTrivia DB + local fallback)
/hangman Classic Hangman with letter-modal input
/wordle Wordle β€” guess the 5-letter word in 6 tries
/tictactoe TicTacToe β€” Easy / Medium / Minimax Hard AI
/connect4 Connect Four β€” bot AI with win/block/center logic
/blackjack Blackjack β€” Hit, Stand, Double Down vs. the dealer
/points Shows your current point balance with a progress bar

Points & Rewards System

Points are stored persistently in data/points.json. Each game awards or deducts points depending on the outcome and difficulty. Reward milestones automatically assign Discord roles and notify the user.

Default reward thresholds:

Points Reward
500 πŸ₯‰ Bronze Player
1,500 πŸ₯ˆ Silver Player
4,000 πŸ₯‡ Gold Player
10,000 πŸ’Ž Diamond Player

Point values per game are configurable in bots/minigames/points_config.json.


Project Structure

discord_multibot_js/
β”œβ”€β”€ main.js                          ← Starts all 3 bots, handles auto-restart
β”œβ”€β”€ package.json
β”œβ”€β”€ .env                             ← Not committed (see .gitignore)
β”œβ”€β”€ .github/
β”‚   └── dependabot.yml               ← Weekly dependency update checks
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ config.js                    ← Environment config
β”‚   β”œβ”€β”€ utils.js                     ← Shared helpers (makeEmbed, readJson, …)
β”‚   └── pointsManager.js             ← Points read/write + reward notifications
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ points.json                  ← Persistent user points (auto-created)
β”‚   └── backups/                     ← Database backup files (auto-created, auto-deleted)
β”œβ”€β”€ assets/                          ← Static files, e.g. terms PDF
└── bots/
    β”œβ”€β”€ commands/
    β”‚   β”œβ”€β”€ bot.js
    β”‚   └── commands/
    β”‚       β”œβ”€β”€ community.js          ← /information, /rules, /roles
    β”‚       β”œβ”€β”€ admin.js              ← /backup_database, /send_message, /send_embed
    β”‚       β”œβ”€β”€ support.js            ← /script_guides
    β”‚       β”œβ”€β”€ orders.js             ← /donation, /order_terms, /order_price
    β”‚       β”œβ”€β”€ utility.js            ← /ping, /userinfo, /clear
    β”‚       └── minigames.js          ← /random, /rg, /flachwitz, /add_flachwitz
    β”œβ”€β”€ events/
    β”‚   β”œβ”€β”€ bot.js
    β”‚   └── handlers/
    β”‚       β”œβ”€β”€ logging.js
    β”‚       β”œβ”€β”€ messageHandler.js
    β”‚       └── contextMenus.js
    └── minigames/
        β”œβ”€β”€ bot.js
        β”œβ”€β”€ points_config.json
        └── commands/
            β”œβ”€β”€ eightball.js
            β”œβ”€β”€ dice.js
            β”œβ”€β”€ flipcoin.js
            β”œβ”€β”€ rps.js
            β”œβ”€β”€ slots.js
            β”œβ”€β”€ trivia.js
            β”œβ”€β”€ hangman.js
            β”œβ”€β”€ wordle.js
            β”œβ”€β”€ tictactoe.js
            β”œβ”€β”€ connect4.js
            β”œβ”€β”€ blackjack.js
            └── points.js

Dependencies

Package Version
discord.js ^14.26.4
dotenv ^16.6.1

Dependency updates are monitored automatically via Dependabot (weekly, grouped).


Links


Β© MSK Scripts – Musiker15

About

A modular Discord bot system built with Discord.js v14, running three independent bots in a single Node.js process.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors