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

github.com/GlobalTechInfo/MEGA-MDX @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
875 symbols 2,210 edges 325 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 TypeScript WhatsApp License 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 Sharp 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-MDX.git
cd MEGA-MDX
npm install
cp sample.env .env
# Edit .env → add SESSION_ID and OWNER_NUMBER
npm run build
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-MDX.git
cd MEGA-MDX

# 2. Install dependencies
npm install

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

# 4. Build TypeScript
npm run build

# 5. Start
npm start

One-Line VPS Installer

sudo bash <(curl -fsSL https://raw.githubusercontent.com/GlobalTechInfo/MEGA-MDX/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-MDX/.env
cd /root/MEGA-MDX && pm2 start dist/index.js --name mega-mdx
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-MDX.git
cd MEGA-MDX
npm install
cp sample.env .env && nano .env
npm run build && npm start

Keep running after closing Termux:

apt install tmux -y

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

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

🖥️ VPS / Linux Server

Ubuntu Debian

One-line install (recommended):

sudo bash <(curl -fsSL https://raw.githubusercontent.com/GlobalTechInfo/MEGA-MDX/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-MDX.git
cd MEGA-MDX
npm install
cp sample.env .env && nano .env
npm run build

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

PM2 commands:

Command Description
pm2 logs mega-mdx Live logs
pm2 restart mega-mdx Restart
pm2 stop mega-mdx 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-MDX.git
cd MEGA-MDX
npm install
cp sample.env .env && nano .env
npm run build && 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-MDX
  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-MDX/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.

Extension points exported contracts — how you extend this code

ChannelInfo (Interface)
(no doc)
types.d.ts
StickerMetadata (Interface)
(no doc)
lib/exif.ts
WebpToMp4Result (Interface)
(no doc)
lib/myfunc2.ts
CppSource (Interface)
(no doc)
lib/compile.ts
StickerExtra (Interface)
(no doc)
lib/sticker.ts
DownloadData (Interface)
(no doc)
plugins/video.ts
DownloadData (Interface)
(no doc)
plugins/play.ts
DownloadData (Interface)
(no doc)
plugins/song.ts

Core symbols most depended-on inside this repo

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

Shape

Function 761
Method 59
Class 33
Interface 22

Languages

TypeScript84%
Python13%
C++3%

Modules by API surface

lib/speed.py93 symbols
lib/lightweight_store.ts40 symbols
lib/index.ts28 symbols
lib/myfunc.ts24 symbols
lib/commandHandler.ts15 symbols
lib/myfunc2.ts12 symbols
plugins/antispam.ts11 symbols
lib/uploaders.ts11 symbols
lib/localbot.py10 symbols
plugins/update.ts9 symbols
plugins/localbot2.ts9 symbols
plugins/localbot.ts9 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-MDX \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact