Feature
Description
π‘οΈ Full Moderation
ban, tban, kick, mute, tmute, warn, promote, demote
β οΈ Warning System
Auto-ban at configurable warn threshold
π― Content Locks
Lock links, media, stickers, polls, forwards per-group
π« Blacklist
Word blacklist with auto-delete & auto-warn
π Notes System
Save & retrieve notes with #name triggers (FallenRobot-style)
π€ Custom Filters
Keyword auto-reply filters stored per-group
π Welcome Messages
Customizable with {name} {id} {title} placeholders
π€ Captcha Verification
Math captcha on join with auto-kick timeout
π Pin Management
pin, unpin, unpinall, purge ranges, cleanup
β±οΈ Slowmode
Set message cooldown via /slowmode <seconds>
π Fun Commands
roll, flip, 8ball, hug, slap, pat, kiss, meme, quote, poll
π Statistics
Group stats, user lookup, admin list
ποΈ MongoDB
Per-group persistent settings, warnings, notes, filters
β‘ Webhook-based
Raw HTTP + Flask β no polling, instant updates
π§ Modular
9 clean modules, easy to extend or disable
KustRobot/
βββ main.py β Flask app + webhook dispatcher
βββ config.py β Environment variables & constants
βββ requirements.txt β Flask, requests, pymongo
βββ database/
β βββ mongo.py β MongoDB collections manager
βββ utils/
β βββ api.py β Raw HTTP Telegram API helper with retries
β βββ helpers.py β is_admin, resolve_target, get/set_chat_setting
βββ modules/
βββ admin.py β ban, kick, mute, warn, promote, demote
βββ greetings.py β welcome messages, captcha verification
βββ rules.py β setrules, rules, clearrules
βββ filters.py β lock/unlock, custom keyword filters
βββ notes.py β save, get, #triggers (FallenRobot-style)
βββ blacklist.py β word blacklist with auto-warn
βββ pins.py β pin, unpin, purge, cleanup, slowmode
βββ fun.py β roll, 8ball, hug, slap, meme, quote
βββ misc.py β start, help, id, whois, stats
Fork this repo first before deploying!
π§ Environment Variables
Set these on your platform or in a .env file:
Variable
Required
Description
BOT_TOKEN
β
Your Telegram bot token from @BotFather
WEBHOOK_SECRET
β
Any random secret string for webhook security
MONGO_URI
β
MongoDB connection string (local or Atlas)
ADMIN_IDS
β
Your Telegram user ID(s), comma-separated
DB_NAME
β
Database name (default: kustrobot)
PORT
β
Server port (default: 5000)
π¦ Platform-Specific Deployment
βοΈ Render (Recommended)
Fork this repo
Go to render.com β New Web Service
Connect your forked repo
Set Build Command: pip install -r requirements.txt
Set Start Command: python main.py
Add environment variables in the dashboard
Deploy β Render gives you a public HTTPS URL
Set your webhook:
curl -X POST " https://api.telegram.org/bot<BOT_TOKEN>/setWebhook" \
-d " url=https://your-app.onrender.com/webhook/<WEBHOOK_SECRET>"
Fork this repo
Go to railway.app β New Project β Deploy from GitHub
Connect your forked repo
Add environment variables under Variables
Add a MongoDB plugin from Railway's marketplace (or use Atlas)
Railway auto-detects Python and deploys β grab your public URL
Set your webhook using the Railway URL
Fork this repo
Go to heroku.com β New App
Connect your GitHub fork under Deploy tab
Set environment variables under Settings β Config Vars
Set buildpack to heroku/python
Enable Automatic Deploys or deploy manually
Set your webhook using https://your-app.herokuapp.com/webhook/<SECRET>
Note: Add a Procfile if not present:
Fork this repo
Go to koyeb.com β Create App
Select GitHub β connect your fork
Set Run command: python main.py
Add environment variables in the app settings
Koyeb gives a public HTTPS URL β set your webhook to it
π₯οΈ VPS / Self-Hosted
# 1. Clone your fork
git clone https://github.com/YOUR_USERNAME/KustRobot
cd KustRobot
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set environment variables
export BOT_TOKEN=" your_token"
export WEBHOOK_SECRET=" your_secret"
export MONGO_URI=" mongodb://localhost:27017"
export ADMIN_IDS=" your_user_id"
# 4. Run (use tmux or screen to keep it alive)
tmux new -s kustrobot
python main.py
# Press Ctrl+B then D to detach
Set up HTTPS with nginx + Let's Encrypt:
# Install nginx + certbot
sudo apt install nginx certbot python3-certbot-nginx
# Get SSL certificate
sudo certbot --nginx -d yourdomain.com
# Add nginx reverse proxy to port 5000
# Then set webhook to: https://yourdomain.com/webhook/<SECRET>
Option 1 β MongoDB Atlas (Cloud, Free):
Go to mongodb.com/atlas
Create a free cluster
Get your connection string: mongodb+srv://user:pass@cluster.mongodb.net/kustrobot
Set this as MONGO_URI
Option 2 β Local MongoDB:
# Install MongoDB
sudo apt install mongodb
# Start service
sudo systemctl start mongodb
# Use this URI:
# mongodb://localhost:27017
Command
Description
/ban @user
Ban a user
/tban @user 1h
Temporarily ban (use s/m/h/d)
/unban @user
Unban a user
/kick @user
Kick a user
/mute @user
Mute a user
/tmute @user 30m
Temporarily mute
/unmute @user
Unmute a user
/warn @user <reason>
Warn a user
/unwarn @user
Remove one warning
/warnings @user
Check warning count
/clearwarns @user
Clear all warnings
/setwarnlimit <n>
Set auto-ban threshold
/promote @user
Promote to admin
/demote @user
Demote admin
/banlist
List banned users
/getadmins
List all admins
Command
Description
/setwelcome <msg>
Set welcome message ({name} {id} {title})
/welcome on|off
Toggle welcome messages
/setcaptcha on|off
Toggle captcha for new members
/setrules <text>
Set group rules
/rules
Show group rules
/clearrules
Clear group rules
/setwarnlimit <n>
Set warning threshold before auto-ban
Command
Description
/lock links|media|stickers|all|forward|polls
Lock content type
/unlock <type>
Unlock content type
/locks
Show current lock status
/filter <keyword> <reply>
Add auto-reply keyword filter
/stop <keyword>
Remove a filter
/filters
List all active filters
/addblacklist <word>
Add word to blacklist
/rmblacklist <word>
Remove from blacklist
/blacklist
List blacklisted words
π Notes (FallenRobot-style)
Command
Description
/save <name> <content>
Save a note
/save <name> (reply)
Save replied message as note
#name
Retrieve note instantly
/get <name>
Get a note by name
/delnote <name>
Delete a note
/notes
List all saved notes
Command
Description
/pin
Pin replied message
/unpin
Unpin current pinned message
/unpinall
Unpin all pinned messages
/purge
Delete messages from reply to now
/cleanup <n>
Delete last n messages (max 100)
/slowmode <seconds>
Set slowmode (0 to disable)
Command
Description
/roll [sides]
Roll a dice
/flip or /toss
Flip a coin
/8ball <question>
Magic 8-ball
/hug [@user]
Send a hug
/slap [@user]
Slap someone
/pat [@user]
Pat someone
/kiss [@user]
Send a kiss
/meme
Random meme
/quote
Inspirational quote
/poll <q>|opt1|opt2
Create a poll
/stickerid
Get sticker file ID
Command
Description
/start
Bot info and overview
/help
Interactive help menu
/id
Your user & chat ID
/whois [@user]
User info and warnings
/stats
Group statistics
ποΈ Database Collections
Collection
Stores
chat_settings
Per-group settings (welcome, rules, locks, warn threshold)
warnings
User warnings with timestamps and reasons
banned_users
Banned user records per group
captcha_challenges
Pending captcha verifications
notes
Saved notes (text, photos, videos, stickers, etc.)
blacklist
Blacklisted words per group
filters
Custom keyword auto-reply filters
Component
Technology
Language
Python 3.7+
Web Framework
Flask 2.3.3
Database
MongoDB 4.6+ (via pymongo)
HTTP Client
Requests 2.31.0
Bot API
Raw Telegram HTTP API
GNU General Public License v3.0 β See LICENSE
Pull requests are welcome. For major changes, open an issue first.
Fork the repo
Create your branch: git checkout -b feature/my-feature
Commit changes: git commit -m "Added my feature"
Push: git push origin feature/my-feature
Open a Pull Request