MCPcopy Index your code
hub / github.com/GlobalTechInfo/MEGA-MD

github.com/GlobalTechInfo/MEGA-MD @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
826 symbols 2,117 edges 319 files 93 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Typing SVG

Version Node.js WhatsApp Stars Forks

250+ Commands · Multi-Platform · Multi-Database · Plugin Architecture

📦 Installation · 🔐 Session Setup · ⚙️ Configuration · 🚀 Deployment · 🔌 Plugins


🌍 Deploy on your favourite platform

Heroku Render Railway Koyeb Fly.io Replit VPS Termux Windows Docker


📋 Table of Contents


✨ Features

Feature Description
🔌 Auto-loading Plugins Drop a .ts file in plugins/ — it loads automatically, zero registration
💬 250+ Commands Group management, privacy, moderation, fun, AI, media, utilities
🗄️ 5 Storage Backends MongoDB, PostgreSQL, MySQL, SQLite, or JSON files
🛡️ Group Protection Anti-spam, bad word filter, link detection, anti-tag abuse
👑 Role System Owner, Sudo, Admin, and User permission levels
Scheduled Messages Schedule messages with natural time input
🤖 AI Chatbot Per-chat AI conversation mode
🔒 Privacy Controls Full WhatsApp privacy management via commands
📊 Polls & Voting Create polls with live vote tracking in groups
📡 Broadcast Bulk message all groups or all DM contacts at once
🔁 Auto-Reply Configurable trigger-based auto responses with {name} support
🎮 Games TicTacToe and more built in
Disappearing Messages Set per-chat or default timers via commands
📱 Multi-Platform Runs on Termux, VPS, Railway, Render, Heroku, Koyeb, Fly.io, Replit

📌 Requirements

Requirement Version Notes
Node.js 20.x or higher Required
npm 8.x or higher Included with Node.js
Git Any recent For cloning
ffmpeg Latest Media processing
libvips Latest Image processing
libwebp Latest Sticker creation

[!WARNING] Never use your personal WhatsApp number for the bot. Always use a dedicated number.


⚡ Quick Start

git clone https://github.com/GlobalTechInfo/MEGA-MD.git
cd MEGA-MD
npm install
cp sample.env .env
# Edit .env → add SESSION_ID and OWNER_NUMBER
npm start

🔐 Getting Your Session ID

[!IMPORTANT] The bot uses a Session ID to connect to WhatsApp without scanning QR every time. Generate it once and paste it in .env.

Step 1 — Open the session generator

🌐 https://mega-pairing.onrender.com

Step 2 — Generate your session

Option A — Pair Code (Recommended)

  1. Enter your bot's WhatsApp number with country code (e.g. 923001234567)
  2. Click Generate Pair Code
  3. An 8-character code appears (e.g. J38K-4PNS)
  4. On your phone: WhatsApp → ⋮ Menu → Linked Devices → Link a Device → Link with phone number
  5. Enter the code — session is created
  6. Copy the Session ID shown on the page

Option B — QR Code

  1. Click the QR Code tab
  2. Scan the QR code with your WhatsApp
  3. Copy the Session ID shown after scanning

Step 3 — Add to .env

SESSION_ID=GlobalTechInfo/MEGA-MD_xxxxxxxxxxxxxxxxxxxxxxxx

Alternative — Pairing via terminal

Leave SESSION_ID empty and set:

PAIRING_NUMBER=923001234567

[!NOTE] The bot will print an 8-character pairing code in the terminal on startup. Link it via WhatsApp → Linked Devices → Link with phone number within 60 seconds.


⚙️ Configuration

Copy sample.env to .env:

cp sample.env .env
# ── REQUIRED (choose one) ────────────────────────────────────
SESSION_ID=GlobalTechInfo/MEGA-MD_your_gist_id_here
# OR
PAIRING_NUMBER=923001234567

# ── REQUIRED ─────────────────────────────────────────────────
OWNER_NUMBER=923000000000        # No + sign

# ── BOT IDENTITY ─────────────────────────────────────────────
BOT_NAME=MEGA-MD-PRO
BOT_OWNER=GlobalTechInfo
PACKNAME=MEGA-MD

# ── BEHAVIOUR ────────────────────────────────────────────────
PREFIXES=.,!,/                   # Comma-separated
COMMAND_MODE=public              # public or private
TIMEZONE=Asia/Karachi

# ── OPTIONAL API KEYS ────────────────────────────────────────
REMOVEBG_KEY=                    # https://remove.bg/api
GIPHY_API_KEY=                   # https://developers.giphy.com

# ── PERFORMANCE ──────────────────────────────────────────────
PORT=5000
MAX_STORE_MESSAGES=50

# ── DATABASE (all empty = JSON files) ────────────────────────
MONGO_URL=
POSTGRES_URL=
MYSQL_URL=
DB_URL=                          # SQLite: ./data/baileys.db

📦 Installation

Manual Install

# 1. Clone
git clone https://github.com/GlobalTechInfo/MEGA-MD.git
cd MEGA-MD

# 2. Install dependencies
npm install

# 3. Configure
cp sample.env .env
nano .env

# 4. Start
npm start

One-Line VPS Installer

sudo bash <(curl -fsSL https://raw.githubusercontent.com/GlobalTechInfo/MEGA-MD/main/lib/install.sh)

[!IMPORTANT] This automatically installs Node.js 20, ffmpeg, libvips, libwebp, PM2, clones the repo, builds it, and sets up data files.

# After install:
nano /root/MEGA-MD/.env
cd /root/MEGA-MD && pm2 start dist/index.js --name mega-md
pm2 save && pm2 startup

🚀 Deployment

📱 Termux (Android)

# Update packages
pkg update && pkg upgrade -y

# Install proot-distro (recommended for full Linux environment)
pkg install proot-distro -y
proot-distro install ubuntu
proot-distro login ubuntu

# Inside Ubuntu — install dependencies
apt update && apt upgrade -y
apt install -y git ffmpeg build-essential libvips-dev webp nodejs npm curl

# Clone and setup
git clone https://github.com/GlobalTechInfo/MEGA-MD.git
cd MEGA-MD
npm install
cp sample.env .env && nano .env
npm start

Keep running after closing Termux:

apt install tmux -y

tmux new -s mega-md    # Start new session
npm start

# Detach:     Ctrl+B → D
# Re-attach:  tmux attach -t mega-md
# List:       tmux ls
# Kill:       tmux kill-session -t mega-md

🖥️ VPS Linux Server

Ubuntu Debian

One-line install (recommended):

sudo bash <(curl -fsSL https://raw.githubusercontent.com/GlobalTechInfo/MEGA-MD/main/lib/install.sh)

Manual:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs git ffmpeg libvips-dev libwebp-dev build-essential

git clone https://github.com/GlobalTechInfo/MEGA-MD.git
cd MEGA-MD
npm install
cp sample.env .env && nano .env

# Keep alive with PM2
npm install -g pm2
pm2 start dist/index.js --name mega-md
pm2 save && pm2 startup

PM2 commands:

Command Description
pm2 logs mega-md Live logs
pm2 restart mega-md Restart
pm2 stop mega-md Stop
pm2 status Status overview

🪟 Windows (WSL)

Windows

# In WSL Ubuntu terminal
sudo apt update
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs git ffmpeg libvips-dev libwebp-dev build-essential

git clone https://github.com/GlobalTechInfo/MEGA-MD.git
cd MEGA-MD
npm install
cp sample.env .env && nano .env
npm start

🔁 Replit

Replit

[!NOTE] The repo includes pre-configured .replit and replit.nix.

  1. Go to replit.comCreate ReplImport from GitHub
  2. Paste: https://github.com/GlobalTechInfo/MEGA-MD
  3. Open Secrets tab (🔒) and add:
Key Value
SESSION_ID GlobalTechInfo/MEGA-MD_your_gist_id
OWNER_NUMBER 923001234567
  1. Click Run

replit.nix automatically installs: Node.js 20, ffmpeg, imagemagick, libwebp, SQLite, pm2 etc.

[!TIP] Free Replit instances sleep after inactivity. Use UptimeRobot to ping your Replit URL every 5 minutes to keep it alive. [!NOTE] Production deployment uses npm run start:optimized (512MB memory limit) — configured in .replit's [deployment] section.


🟣 Heroku

Heroku

[!NOTE] The repo includes heroku.yml and app.json for Docker-based deployment.

Either you can deploy via dashboard or using heroku cli

One-line Deployer:

bash <(curl -s https://raw.githubusercontent.com/GlobalTechInfo/MEGA-MD/main/lib/heroku.sh)

Manual:

heroku login
heroku create your-bot-name
heroku stack:set container

heroku config:set SESSION_ID=GlobalTechInfo/MEGA-MD_your_gist_id
heroku config:set OWNER_NUMBER=923001234567
heroku config:set MONGO_URL=your_mongodb_url   # Recommended

git push heroku main
heroku ps:scale web=1
heroku logs --tail

[!IMPORTANT] Heroku's filesystem is ephemeral — data is lost on restart. Use MongoDB or PostgreSQL for persistent storage. [!NOTE] Heroku uses heroku.yml → Docker build → runs npm run start:optimized.


🎨 Render

Render

[!NOTE] The repo includes render.yaml for one-click Blueprint deployment.

  1. Fork this repo
  2. render.comNewBlueprint → connect your fork
  3. Render reads render.yaml automatically
  4. Set environment variables in the dashboard:
  5. SESSION_ID
  6. OWNER_NUMBER
  7. Deploy

[!IMPORTANT] Render uses Docker (Dockerfile) and runs npm run start:optimized. Use a database for persistent storage on Render's free tier.


🚂 Railway

Railway

  1. Fork

Core symbols most depended-on inside this repo

printLog
called by 80
lib/print.js
printer
called by 38
lib/speed.py
json
called by 30
lib/speed.py
loadUserGroupData
called by 26
lib/index.js
close
called by 24
lib/speed.py
connect
called by 22
lib/speed.py
dataFile
called by 20
lib/paths.js
run
called by 18
lib/speed.py

Shape

Function 734
Method 59
Class 33

Languages

TypeScript84%
Python13%
C++3%

Modules by API surface

lib/speed.py93 symbols
lib/lightweight_store.js40 symbols
lib/index.js28 symbols
lib/myfunc.js24 symbols
lib/commandHandler.js15 symbols
lib/uploaders.js11 symbols
lib/myfunc2.js11 symbols
plugins/update.js9 symbols
lib/sudoku.py9 symbols
plugins/chatbot.js8 symbols
plugins/autotyping.js8 symbols
plugins/antispam.js8 symbols

Datastores touched

ChatCollection · 1 repos
ContactCollection · 1 repos
MessageCollection · 1 repos
MessageCountCollection · 1 repos
MetadataCollection · 1 repos
SettingCollection · 1 repos
(mongodb)Database · 1 repos
(mysql)Database · 1 repos

For agents

$ claude mcp add MEGA-MD \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact