src/commands/owner/cmd2.js
✨ Install from URL - Download and install commands from pastebin or any URL
📝 Create with Code - Write commands inline with guided prompts
📤 Upload Files - Upload .js files by replying to them
👁️ View Commands - Download and view command source code
🗑️ Delete Commands - Safe deletion with confirmation
📋 List Commands - View all commands by category
🔄 Smart Confirmations - React with ✅ or ❌ to confirm actions
.cmd2 list # List all categories
.cmd2 list general # List commands in general category
.cmd2 install https://pastebin.com/raw/xyz general
# Install from URL to general category
.cmd2 code general mycommand # Create new command with inline code
(Then paste your code in next message)
.cmd2 upload fun # Upload a .js file
(Reply to a .js file with this)
.cmd2 view general/ping.js # View/download command file
.cmd2 delete general/test.js # Delete command (with confirmation)
| Action | Aliases | Description |
|---|---|---|
list |
ls, all | View all commands or by category |
install |
add, i | Install command from URL |
code |
create, new | Create command with inline code |
upload |
attach, u | Upload .js file (reply to file) |
view |
get, show, download, v | View/download command |
delete |
remove, rm, d | Delete command file |
src/commands/owner/whitelist.js
🔒 Enable/Disable Mode - Control who can use the bot
➕ Add Users - Whitelist users by replying to them
➖ Remove Users - Remove users from whitelist
📋 List Users - View all whitelisted users
🗑️ Clear All - Remove all whitelisted users
📊 Status Check - View current whitelist status
🎯 Smart Integration - Automatically blocks non-whitelisted users
.whitelist enable # Activate whitelist mode
Only owner + whitelisted users can use bot
.whitelist disable # Deactivate whitelist mode
Everyone can use bot again
.whitelist add # Whitelist a user
(Reply to their message)
.whitelist remove # Remove a user
(Reply to their message)
.whitelist list # Show all whitelisted users
.whitelist status # Check current status
.whitelist clear # Remove all whitelisted users
When Whitelist is ENABLED:
- ✅ Bot Owner - Full access (always)
- ✅ Whitelisted Users - Full access
- ❌ Other Users - Completely blocked (bot ignores them)
When Whitelist is DISABLED:
- 🌐 Everyone can use the bot normally
Method 1: Reply to Message
- User sends a message
- Owner replies:
.whitelist add - User is whitelisted instantly
- Bot confirms in chat
Method 2: Mention User
.whitelist add @1234567890
Method 3: Phone Number
.whitelist add 1234567890
| Action | Aliases | Description |
|---|---|---|
enable |
on, activate | Activate whitelist mode |
disable |
off, deactivate | Deactivate whitelist mode |
add |
allow, permit, + | Add user to whitelist |
remove |
delete, revoke, - | Remove user from whitelist |
list |
show, users, all | List all whitelisted users |
clear |
reset, removeall | Remove all users |
status |
info, check | Show current status |
Both commands feature:
- 📊 Box-style formatted responses
- ✨ Clear emoji indicators
- 💡 Helpful error messages
- 🎯 Step-by-step guides
- 🔄 Smart confirmation system
- React ✅ to confirm actions
- React ❌ to cancel
- Auto-timeout after 60 seconds
- Safe deletions and overwrites
- Comprehensive error messages
- Validation checks
- User-friendly error displays
- Logging for debugging
The whitelist system is fully integrated into your message handler:
- Location:
src/handlers/messageHandler.js - Automatic: No manual setup needed
- Transparent: Works seamlessly in background
- Logged: All blocks/allows are logged
- Whitelist Data:
cache/whitelist.json - Auto-created: First time you use whitelist command
- Persistent: Survives bot restarts
- Format: Clean JSON for easy editing
- Test commands before installing - View the code first
- Use confirmations - Always check before overwriting
- Organize by category - Keep commands in proper folders
- Backup important commands - Use
.cmd2 viewto download
- Enable before adding users - Can add while disabled too
- Notify users - Bot auto-notifies whitelisted users in groups
- List regularly - Check who has access
- Clear when needed - Easy to reset and start fresh
- Use status command - Always check current state
- Language: ES6+ JavaScript
- Dependencies: fs-extra, axios, path
- Owner Only: Yes
- Cooldown: 3 seconds
- Supports: React confirmations, file uploads
- Storage: JSON file (cache/whitelist.json)
- Integration: Message handler middleware
- Owner Check: Uses config.owner/ownerNumbers
- User Check: JID-based (WhatsApp ID)
- Logging: Full activity logging
1. .cmd2 install https://pastebin.com/raw/abc123 fun
2. Bot downloads and shows file info
3. If exists: React ✅ to replace
4. Bot confirms installation
5. Restart bot to load command
1. .whitelist enable
2. Bot now only responds to owner
3. User messages bot
4. Owner replies to user: .whitelist add
5. User gets notified
6. User can now use bot
7. Check status: .whitelist list
1. .cmd2 code general greet
2. Bot asks for code
3. Paste your command code
4. If exists: React ✅ to replace
5. Bot confirms creation
6. Restart bot to use
Both commands are production-ready and fully functional:
✅ CMD2: Perfect for managing bot commands dynamically
✅ Whitelist: Complete access control system
✅ Integrated: Works seamlessly with your bot
✅ Safe: Confirmations and error handling
✅ Beautiful: Clean, user-friendly interface
✅ Logged: All actions are logged
Your bot is now equipped with professional command management and access control! 🎉
💫 Ilom Bot 🍀 - Powered by Advanced Command Systems