Telegram moderation bot with spam detection, banned words, and phone number filtering.
- 🛡️ Multi-layer protection: banned words, phone numbers, spam, coded messages
- 👮 Admin panel (private chat): add banned words / allowed numbers
- 🤖 Auto-superAdmin on first use
- 🌐 Webhook (prod) & polling (dev) support
npm install.env
BOT_TOKEN=xxx
MONGO_URI=xxx
NODE_ENV=development
PORT=3000node addAdmin.js # creates superAdmin (edit ID in file)
npm run dev # polling mode- Push code to GitHub
- Create new Web Service on Render
- Connect repo, set:
- Build Command:
npm install - Start Command:
npm start
- Build Command:
- Add environment variables:
BOT_TOKENMONGO_URINODE_ENV=productionWEBHOOK_BASE_URL=https://your-app.onrender.com
- Deploy ✅
Bot auto-configures webhook on startup.
Messages checked for: banned words → spam (3+ repeats) → unapproved numbers → coded chars → shared contacts → username violations.
Groups: violators banned • Private: message deleted + warning
/admin– open admin panel (private only)- Keyboard buttons to add banned words & allowed numbers
index.js # entry
server.js # webhook/polling setup
src/
├── admin/
│ └── adminCommands.js
├── middleware/ # 6 moderation layers
├── models/ # Admin, BanWord, Number
├── normalization/ # Arabic/text cleaners
└── config/
└── db.js