Skip to content

Latest commit

 

History

History
257 lines (193 loc) · 7.25 KB

File metadata and controls

257 lines (193 loc) · 7.25 KB

🎯 NEW COMMANDS GUIDE

Created Commands for Your Ilom WhatsApp Bot


1. 📦 CMD2 - Advanced Command Manager

Location

src/commands/owner/cmd2.js

Features

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

Usage Examples

.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)

Command Actions

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

2. 🔐 WHITELIST - Access Control System

Location

src/commands/owner/whitelist.js

Features

🔒 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

Usage Examples

.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

How It Works

When Whitelist is ENABLED:

  1. Bot Owner - Full access (always)
  2. Whitelisted Users - Full access
  3. Other Users - Completely blocked (bot ignores them)

When Whitelist is DISABLED:

  • 🌐 Everyone can use the bot normally

Whitelisting Users

Method 1: Reply to Message

  1. User sends a message
  2. Owner replies: .whitelist add
  3. User is whitelisted instantly
  4. Bot confirms in chat

Method 2: Mention User

.whitelist add @1234567890

Method 3: Phone Number

.whitelist add 1234567890

Command Actions

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

🎨 Design Features

Beautiful Interface

Both commands feature:

  • 📊 Box-style formatted responses
  • ✨ Clear emoji indicators
  • 💡 Helpful error messages
  • 🎯 Step-by-step guides
  • 🔄 Smart confirmation system

Smart Confirmations

  • React ✅ to confirm actions
  • React ❌ to cancel
  • Auto-timeout after 60 seconds
  • Safe deletions and overwrites

Error Handling

  • Comprehensive error messages
  • Validation checks
  • User-friendly error displays
  • Logging for debugging

🚀 Integration

Whitelist Integration

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

Data Storage

  • Whitelist Data: cache/whitelist.json
  • Auto-created: First time you use whitelist command
  • Persistent: Survives bot restarts
  • Format: Clean JSON for easy editing

💡 Tips & Best Practices

CMD2 Tips

  1. Test commands before installing - View the code first
  2. Use confirmations - Always check before overwriting
  3. Organize by category - Keep commands in proper folders
  4. Backup important commands - Use .cmd2 view to download

Whitelist Tips

  1. Enable before adding users - Can add while disabled too
  2. Notify users - Bot auto-notifies whitelisted users in groups
  3. List regularly - Check who has access
  4. Clear when needed - Easy to reset and start fresh
  5. Use status command - Always check current state

🔧 Technical Details

CMD2 Technical

  • Language: ES6+ JavaScript
  • Dependencies: fs-extra, axios, path
  • Owner Only: Yes
  • Cooldown: 3 seconds
  • Supports: React confirmations, file uploads

Whitelist Technical

  • 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

🎯 Example Workflows

Workflow 1: Installing a New Command

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

Workflow 2: Setting Up Exclusive Bot

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

Workflow 3: Creating Custom Command

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

📝 Summary

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