autoft-bot-wildcard
v1.2.3
Published
π Advanced Telegram Bot for Cloudflare Wildcard Domain Management with Telegram Notifications
Downloads
16
Maintainers
Readme
π AutoFT Bot Wildcard
π The most advanced Telegram bot for automated Cloudflare wildcard domain management
π Documentation β’ π Quick Start β’ π¬ Support β’ π Issues
π Table of Contents
- β¨ Features
- π Quick Start
- π¦ Installation
- βοΈ Configuration
- π± Usage
- π― Commands
- π Admin Features
- π§ Advanced Configuration
- π Deployment
- π οΈ Development
- β FAQ
- π Troubleshooting
- π€ Contributing
- π License
β¨ Features
π― Core Functionality
- π Wildcard Domain Management - Automated Cloudflare wildcard DNS setup
- π€ Telegram Bot Interface - Complete bot management via Telegram
- π₯ Multi-User Support - Each user manages their own domains
- π Secure Configuration - Encrypted API key storage
- π Real-time Analytics - Domain statistics and monitoring
- β‘ Lightning Fast - Optimized for performance
- π’ Telegram Notifications - Real-time alerts and updates
π‘οΈ Security & Management
- π Admin Dashboard - Complete administrative control
- π Permission System - Role-based access control
- π’ Broadcast System - Mass communication tools
- π‘οΈ Rate Limiting - Built-in abuse protection
- π Comprehensive Logging - Detailed activity tracking
π§ Technical Features
- π¦ NPM Package - Global installation support
- π¨ Interactive Setup - Beautiful CLI wizard
- π Auto-restart - Process management ready
- π± Simplified Setup - Only requires bot token and group ID
- π Environment Variables - Flexible configuration
π Quick Start
Get your bot running in under 3 minutes!
1οΈβ£ Install Globally
npm install -g autoft-bot-wildcard2οΈβ£ Run Interactive Setup
autoft-bot-wildcard3οΈβ£ Start Your Bot
cd autoft-bot-wildcard
npm startπ That's it! Your bot is now live and ready to manage wildcard domains!
π¦ Installation
Prerequisites
- Node.js 16+ - Download here
- Telegram Bot Token - Get from @BotFather
- Cloudflare Account - Sign up here
Method 1: Global Installation (Recommended)
# Install globally
npm install -g autoft-bot-wildcard
# Run setup wizard
autoft-bot-wildcardMethod 2: Local Installation
# Clone repository
git clone https://github.com/AutoFTbot/Wildcard-Bot.git
cd Wildcard-Bot
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit configuration
nano .env
# Start bot
npm startMethod 3: Docker (Coming Soon)
docker run -d --name autoft-bot-wildcard \
-e BOT_TOKEN=your_token \
-e ADMIN_IDS=your_id \
autoft-bot-wildcard:latestβοΈ Configuration
Environment Variables
Create a .env file in your project root:
# π€ Bot Configuration
BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
ADMIN_IDS=123456789,987654321
# π’ Notifications (Optional)
TELEGRAM_GROUP_ID=-1001234567890
# π§ Optional Settings
MAX_CUSTOM_DOMAINS=5
NODE_ENV=production
LOG_LEVEL=infoConfiguration File
Customize your bot behavior in config/default.js:
module.exports = {
// Admin Configuration
ADMIN_IDS: [123456789, 987654321],
// Domain Limits
MAX_CUSTOM_DOMAINS: 5,
MAX_DOMAINS_PER_USER: 10,
// Available Domains
DEFAULT_DOMAINS: [
'yourdomain.com',
'example.org',
'demo.net'
],
// Notification Settings - Only Telegram supported
NOTIFICATIONS: {
TELEGRAM: {
enabled: true,
groupId: process.env.TELEGRAM_GROUP_ID || '',
},
},
// Security Settings
FORBIDDEN_KEYWORDS: [
'admin', 'root', 'api', 'mail'
],
// Rate Limiting
RATE_LIMITS: {
SETUP_WILDCARD: {
PER_USER: 3,
COOLDOWN: 3600
}
}
};π± Usage
For End Users
1. Initial Setup
/start β Welcome message and setup guide
/addcf <api_key> <email> β Register Cloudflare credentials2. Domain Management
/listdomain β View available domains
/setupwildcard example.com β Setup wildcard for domain
/new subdomain.example.com β Create custom subdomain
/mysub β View your subdomains3. Analytics & Monitoring
/analytics example.com β View domain statistics
/clearcache example.com β Clear Cloudflare cacheFor Bot Owners (Admins)
1. User Management
/stats β Bot usage statistics
/userinfo 123456789 β View user details
/broadcast Hello everyone! β Message all users2. System Management
/testnotif β Test notification systemπ― Commands
π° Basic Commands
| Command | Description | Usage |
| -------- | ----------------------------- | -------- |
| /start | Welcome message & setup guide | /start |
| /help | Show all available commands | /help |
| /ping | Check bot responsiveness | /ping |
π§ Configuration Commands
| Command | Description | Usage |
| ----------- | ----------------------------- | ----------------------------- |
| /addcf | Add Cloudflare credentials | /addcf <api_key> <email> |
| /cfconfig | View current configuration | /cfconfig |
| /updatecf | Update Cloudflare credentials | /updatecf <api_key> <email> |
| /deletecf | Remove configuration | /deletecf |
π Domain Management Commands
| Command | Description | Usage |
| ---------------- | ----------------------- | ----------------------------- |
| /listdomain | Show available domains | /listdomain |
| /setupwildcard | Setup wildcard domain | /setupwildcard <domain> |
| /new | Create custom subdomain | /new <subdomain.domain.com> |
| /mysub | View your subdomains | /mysub |
| /searchdomain | Search domains | /searchdomain <keyword> |
| /delsub | Delete subdomain | /delsub <subdomain> |
π Analytics Commands
| Command | Description | Usage |
| ------------- | ---------------------- | ---------------------- |
| /analytics | View domain statistics | /analytics <domain> |
| /clearcache | Clear Cloudflare cache | /clearcache <domain> |
π Admin Features
π Statistics Dashboard
π BOT STATISTICS
π₯ Users & Domains:
β’ Registered Users: 150
β’ Active Domains: 45
β’ Total Subdomains: 1,234
β‘ System Status:
β’ Uptime: 7d 12h 30m
β’ Memory Usage: 45.2 MB
β’ Node.js Version: v20.10.0
π€ Bot Info:
β’ Bot Username: @YourWildcardBot
β’ Last Updated: 2024-01-15 14:30:25π’ Broadcast System
Send messages to all registered users:
/broadcast π¨ Scheduled maintenance in 1 hour. All services will be temporarily unavailable.π€ User Management
Get detailed user information:
/userinfo 123456789
π€ USER INFORMATION
π User ID: 123456789
π± Telegram: @username (John Doe)
π§ Cloudflare Email: [email protected]
π Custom Domains: 5
π
Registration: 2024-01-10 09:15:32π§ Advanced Configuration
Custom Domain Setup
Add your own domains to the bot:
// config/default.js
DEFAULT_DOMAINS: [
'your-domain.com',
'another-domain.net',
'example.org'
]Notification Customization
Configure Telegram notifications:
NOTIFICATIONS: {
TELEGRAM: {
enabled: true,
groupId: process.env.TELEGRAM_GROUP_ID,
// Custom message templates
templates: {
welcome: 'π New user registered: {username}',
domainSetup: 'π Wildcard setup: {domain} by {user}'
}
}
}Rate Limiting Configuration
Prevent abuse with custom rate limits:
RATE_LIMITS: {
SETUP_WILDCARD: {
PER_USER: 5, // Max 5 setups per user
COOLDOWN: 3600 // 1 hour cooldown
},
ANALYTICS: {
PER_USER: 10, // Max 10 requests per hour
COOLDOWN: 300 // 5 minutes between requests
}
}π Deployment
Production Deployment with PM2
# Install PM2 globally
npm install -g pm2
# Start bot with PM2
pm2 start index.js --name "autoft-bot-wildcard"
# Enable auto-restart on server reboot
pm2 startup
pm2 save
# Monitor logs
pm2 logs autoft-bot-wildcard
# Restart bot
pm2 restart autoft-bot-wildcardEnvironment Setup for Production
# Set production environment
export NODE_ENV=production
# Increase memory limit if needed
node --max-old-space-size=2048 index.jsNginx Reverse Proxy (Optional)
If you plan to add webhooks:
server {
listen 80;
server_name your-bot-domain.com;
location /webhook {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}π οΈ Development
Project Structure
autoft-bot-wildcard/
βββ π bin/
β βββ wildcard-bot.js # CLI entry point
βββ π config/
β βββ constants.js # Application constants
β βββ default.js # Default configuration
βββ π handlers/
β βββ adminHandlers.js # Admin command handlers
β βββ cloudflareHandlers.js # Cloudflare operations
β βββ configHandlers.js # Configuration management
β βββ domainHandlers.js # Domain operations
β βββ generalHandlers.js # General bot commands
βββ π lib/
β βββ WildcardBot.js # Main bot class
βββ π services/
β βββ CloudflareManager.js # Cloudflare API wrapper
β βββ NotificationService.js # Notification system
βββ π utils/
β βββ fileUtils.js # File operations
β βββ systemUtils.js # System utilities
β βββ validation.js # Input validation
βββ π data/ # Bot data storage
βββ .env.example # Environment template
βββ index.js # Application entry point
βββ package.json # Dependencies
βββ README.md # DocumentationRunning in Development Mode
# Clone repository
git clone https://github.com/AutoFTbot/Wildcard-Bot.git
cd Wildcard-Bot
# Install dependencies
npm install
# Copy environment file
cp .env.example .env
# Edit configuration
nano .env
# Start in development mode
npm run devCode Style and Linting
# Run linter
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format
# Run all checks
npm run checkTesting
# Test configuration
npm run test:config
# Test notifications
npm run test:notifications
# Test Cloudflare connection
npm run test:cloudflareβ FAQ
Q: How do I get a Telegram Bot Token?
A: Message @BotFather on Telegram, use /newbot command, and follow the instructions.
Q: Where do I find my Cloudflare Global API Key?
A: Go to Cloudflare Dashboard β My Profile β API Tokens β Global API Key β View
Q: How do I get my Telegram ID?
A: Message @userinfobot on Telegram to get your user ID.
Q: Can I use custom domains?
A: Yes! Add your domains to the DEFAULT_DOMAINS array in config/default.js.
Q: Is there a limit on users or domains?
A: You can configure limits in config/default.js. Default is 5 domains per user.
Q: How do I update the bot?
A: Run npm update -g autoft-bot-wildcard for global installations.
Q: "autoft-bot-wildcard command not found" error
This happens when the global installation didn't complete properly:
# Reinstall globally
npm install -g autoft-bot-wildcard --force
# Clear npm cache if needed
npm cache clean --force
# Check if command is available
which autoft-bot-wildcard
# Alternative: run directly with npx
npx autoft-bot-wildcardπ Troubleshooting
Common Issues
π΄ Bot not responding
# Check if bot is running
ps aux | grep node
# Check logs
pm2 logs autoft-bot-wildcard
# Restart bot
pm2 restart autoft-bot-wildcardπ΄ "Bot token invalid" error
- Verify your bot token in
.envfile - Make sure token format is correct:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz - Check if bot was deleted in @BotFather
π΄ Cloudflare API errors
- Verify Global API Key and email in user configuration
- Check if domain is added to Cloudflare account
- Ensure API key has necessary permissions
π΄ Notifications not working
- Verify
TELEGRAM_GROUP_IDin environment variables - Make sure bot is added to the notification group
- Check if bot has permission to send messages
π΄ Domain setup fails
- Ensure domain is registered in Cloudflare
- Check DNS propagation status
- Verify Cloudflare account permissions
π΄ Installation fails
- Make sure you have Node.js 16+ installed
- Try clearing npm cache:
npm cache clean --force - Use the latest npm version:
npm install -g npm@latest
Debug Mode
Enable detailed logging:
export LOG_LEVEL=debug
npm startGetting Help
- Check our Wiki
- Search existing issues
- Join our Telegram group
- Create a new issue
π€ Contributing
We welcome contributions! Here's how you can help:
π Bug Reports
- Use the issue template
- Include detailed reproduction steps
- Provide relevant logs and screenshots
β¨ Feature Requests
- Check existing requests
- Use the feature template
- Explain the use case and benefits
π» Code Contributions
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test thoroughly
- Follow our coding standards (run
npm run lint) - Commit with clear messages:
git commit -m 'Add amazing feature' - Push to your branch:
git push origin feature/amazing-feature - Open a Pull Request
π Documentation
- Improve existing documentation
- Add examples and use cases
- Translate to other languages
- Create video tutorials
π Roadmap
π Upcoming Features
- [ ] Web Dashboard - Browser-based management interface
- [ ] Docker Support - Containerized deployment
- [ ] Multi-language - Support for multiple languages
- [ ] Advanced Analytics - Detailed usage statistics
- [ ] Custom Commands - User-defined bot commands
- [ ] Backup System - Automated data backups
- [ ] Plugin System - Extensible architecture
π― Long-term Goals
- [ ] Cloud Hosting - Managed hosting service
- [ ] Mobile App - Native mobile application
- [ ] Enterprise Features - Advanced business features
- [ ] API Gateway - RESTful API interface
π Statistics
π License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 AutoFTbot Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.π Acknowledgments
- Telegraf.js - Telegram Bot API framework
- Cloudflare - DNS and CDN services
- Node.js Community - Runtime environment
- Contributors - Everyone who helped improve this project
π Support & Community
π¬ Get Help
π Stay Updated
β If this project helped you, please give it a star!
Made with β€οΈ by the AutoFTbot Team
π Get Started Now β’ π Read the Docs β’ π¬ Join Community
