Skip to content

Commit 5e14974

Browse files
committed
Major Update: Make PostBot Public-Ready
New Features: - Enhanced configuration management with environment variables - Comprehensive admin panel with backup, analytics, and user management - Advanced logging system with file rotation - Automated backup system with scheduling and cleanup - Docker support with docker-compose configuration - CI/CD pipeline with GitHub Actions Improvements: - Migrated from hardcoded values to Config class - Enhanced security by removing sensitive tokens - Improved error handling and validation - Better documentation with badges and setup guides - Professional README with feature highlights Documentation: - Comprehensive CONTRIBUTING.md with development guidelines - CHANGELOG.md with version history and migration guide - Enhanced README with installation and usage instructions - Environment configuration template (.env.example) Security: - Environment variable configuration - Admin permission checks - Rate limiting support - Input validation and sanitization Structure: - New admin handlers for system management - Enhanced utilities for logging and backups - Docker configuration for easy deployment - GitHub workflow for automated testing Developer Experience: - Updated repository links to KunalG932/PostBot - Professional branding and attribution - Clear contribution guidelines - Comprehensive testing framework
1 parent 9f42bed commit 5e14974

23 files changed

Lines changed: 2807 additions & 310 deletions

.dockerignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Git and version control
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# Python
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
*.so
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# Virtual environments
31+
venv/
32+
ENV/
33+
env/
34+
.venv
35+
36+
# Environment files
37+
.env
38+
.env.local
39+
.env.*.local
40+
41+
# IDE and editors
42+
.vscode/
43+
.idea/
44+
*.swp
45+
*.swo
46+
*~
47+
.DS_Store
48+
Thumbs.db
49+
50+
# Logs and temporary files
51+
logs/
52+
*.log
53+
*.tmp
54+
*.temp
55+
56+
# Backup files
57+
backups/
58+
*.backup
59+
*.bak
60+
61+
# Documentation build
62+
docs/_build/
63+
site/
64+
65+
# Testing
66+
.coverage
67+
.pytest_cache/
68+
.tox/
69+
.nox/
70+
htmlcov/
71+
72+
# Local configuration
73+
config.local.*
74+
local_settings.py
75+
76+
# OS generated files
77+
.DS_Store
78+
.DS_Store?
79+
._*
80+
.Spotlight-V100
81+
.Trashes
82+
ehthumbs.db
83+
Thumbs.db
84+
85+
# Windows
86+
desktop.ini
87+
88+
# Node.js (if any)
89+
node_modules/
90+
npm-debug.log*
91+
yarn-debug.log*
92+
yarn-error.log*
93+
94+
# Temporary Docker files
95+
Dockerfile.dev
96+
docker-compose.dev.yml
97+
docker-compose.override.yml

.env.example

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Environment Variables Template
2+
# Copy this file to .env and fill in your actual values
3+
4+
# Telegram Bot Configuration
5+
BOT_TOKEN=your_bot_token_here
6+
# Get this from @BotFather on Telegram
7+
8+
# Database Configuration
9+
MONGO_URI=mongodb://localhost:27017/postbot
10+
DATABASE_NAME=postbot
11+
# Use local MongoDB or provide your cloud MongoDB connection string
12+
# Example for MongoDB Atlas: mongodb+srv://username:password@cluster.mongodb.net/dbname
13+
14+
# Optional Configuration
15+
CHANNEL_ID=0
16+
# Default channel ID (optional)
17+
18+
# Admin Configuration
19+
ADMIN_IDS=123456789,987654321
20+
# Comma-separated list of admin user IDs
21+
22+
# Bot Limits
23+
MAX_CHANNELS_PER_USER=10
24+
MAX_BUTTONS_PER_POST=10
25+
MAX_MEDIA_PER_POST=10
26+
27+
# Cache Settings
28+
CACHE_TTL=3600
29+
# Cache time-to-live in seconds (1 hour = 3600)
30+
31+
# Logging Configuration
32+
LOG_LEVEL=INFO
33+
LOG_FILE=postbot.log
34+
35+
# Feature Flags
36+
ENABLE_ANALYTICS=true
37+
ENABLE_BACKUP=true
38+
ENABLE_NOTIFICATIONS=true
39+
40+
# Rate Limiting
41+
RATE_LIMIT_REQUESTS=30
42+
RATE_LIMIT_WINDOW=60
43+
# 30 requests per 60 seconds window
44+
45+
# Backup Settings
46+
BACKUP_INTERVAL=86400
47+
BACKUP_RETENTION=7
48+
# Backup every 24 hours, keep for 7 days
49+
50+
# Developer Information (Already set in config.py)
51+
# DEVELOPER_USERNAME=DevIncognito
52+
# DEVELOPER_CHANNEL=@incognitobots
53+
# BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
54+
# MONGO_URI=mongodb+srv://user:pass@cluster.mongodb.net/postbot
55+
# CHANNEL_ID=-1001234567890
File renamed without changes.

CHANGELOG.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Changelog 📝
2+
3+
All notable changes to PostBot will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased] 🚧
9+
10+
### Added
11+
- Advanced analytics dashboard
12+
- Bot cloning functionality
13+
- User feedback system
14+
- Automated backup system
15+
- Docker support
16+
- CI/CD pipeline
17+
- Performance monitoring
18+
19+
### Changed
20+
- Improved error handling
21+
- Enhanced logging system
22+
- Optimized database queries
23+
24+
## [2.0.0] - 2025-25-05 🎉
25+
26+
### Added
27+
- **🔧 Configuration Management**
28+
- Comprehensive config.py with environment variable support
29+
- Feature flags for analytics, backup, and notifications
30+
- Rate limiting configuration
31+
- Admin settings and permissions
32+
33+
- **📊 Enhanced Analytics**
34+
- Detailed bot statistics with time-based analysis
35+
- Admin-only analytics command with growth metrics
36+
- Daily, weekly, and monthly user growth tracking
37+
- Post creation analytics and user activity metrics
38+
39+
- **🛡️ Security Improvements**
40+
- Removed all hardcoded tokens and sensitive data
41+
- Environment variable configuration with .env support
42+
- Admin-only commands with proper permission checks
43+
- Rate limiting support for API protection
44+
45+
- **📚 Documentation**
46+
- Comprehensive README.md with badges and features
47+
- CONTRIBUTING.md with detailed development guidelines
48+
- .env.example template with all configuration options
49+
- API documentation with code examples
50+
51+
- **🎨 UI/UX Enhancements**
52+
- Enhanced welcome message with feature overview
53+
- Developer info button in main menu
54+
- Inline keyboard for developer contact and updates channel
55+
- Improved button layouts and user navigation
56+
57+
- **⚙️ Developer Features**
58+
- Configuration validation and error handling
59+
- Feature status checking and management
60+
- Enhanced logging with configurable levels
61+
- Backup and retention settings
62+
63+
### Changed
64+
- **🔄 Code Structure**
65+
- Migrated from hardcoded constants to environment configuration
66+
- Improved error handling across all handlers
67+
- Enhanced database connection management
68+
- Better separation of concerns in code organization
69+
70+
- **📱 User Experience**
71+
- More informative welcome messages
72+
- Better error messages with clear explanations
73+
- Improved navigation with developer contact options
74+
- Enhanced statistics display with formatting
75+
76+
- **🗃️ Database**
77+
- Added user activity tracking
78+
- Enhanced user data collection for analytics
79+
- Improved database query optimization
80+
- Better error handling for database operations
81+
82+
### Fixed
83+
- Import errors in configuration modules
84+
- Database connection reliability
85+
- Error handling in statistics commands
86+
- Memory leaks in long-running processes
87+
88+
### Security
89+
- Removed hardcoded bot tokens and database credentials
90+
- Added environment variable validation
91+
- Implemented proper admin authentication
92+
- Enhanced error message sanitization
93+
94+
## [1.0.0] - 2025-20-05 📱
95+
96+
### Added
97+
- **🤖 Core Bot Functionality**
98+
- Telegram bot with aiogram framework
99+
- MongoDB database integration
100+
- User registration and management
101+
- Channel connection capabilities
102+
103+
- **📝 Post Management**
104+
- Create and send posts to connected channels
105+
- Media support (photos, videos, documents)
106+
- Inline keyboard buttons with custom URLs
107+
- Post scheduling and management
108+
109+
- **👥 User Features**
110+
- User profile management
111+
- Channel connection and verification
112+
- Post history and analytics
113+
- Settings and preferences
114+
115+
- **🎯 Channel Integration**
116+
- Connect multiple Telegram channels
117+
- Verify channel ownership
118+
- Bulk posting capabilities
119+
- Channel statistics and insights
120+
121+
- **📊 Basic Analytics**
122+
- User count and growth tracking
123+
- Post creation statistics
124+
- Channel connection metrics
125+
- Basic activity monitoring
126+
127+
### Technical Implementation
128+
- **🏗️ Architecture**
129+
- Modular handler-based structure
130+
- Asynchronous programming with asyncio
131+
- MongoDB with motor driver
132+
- Router-based command handling
133+
134+
- **📁 Project Structure**
135+
```
136+
postbot/
137+
├── handlers/ # Command and message handlers
138+
├── utils/ # Utility functions and keyboards
139+
├── db.py # Database connection and operations
140+
├── constants.py # Bot configuration and constants
141+
├── main.py # Application entry point
142+
└── requirements.txt # Python dependencies
143+
```
144+
145+
## [0.1.0] - Initial Development 🛠️
146+
147+
### Added
148+
- Basic project setup and structure
149+
- Initial Telegram bot integration
150+
- Database schema design
151+
- Core handler framework
152+
- Development environment setup
153+
154+
---
155+
156+
## Legend 📖
157+
158+
- 🎉 **Major Release** - Significant new features and improvements
159+
-**New Feature** - Added functionality
160+
- 🔧 **Enhancement** - Improved existing features
161+
- 🐛 **Bug Fix** - Fixed issues and problems
162+
- 🛡️ **Security** - Security-related changes
163+
- 📚 **Documentation** - Documentation updates
164+
- 🚧 **Work in Progress** - Features under development
165+
166+
## Migration Guide 🔄
167+
168+
### Upgrading to v2.0.0
169+
170+
1. **Environment Configuration**
171+
```bash
172+
# Copy the new environment template
173+
cp .env.example .env
174+
175+
# Update your .env file with required values
176+
BOT_TOKEN=your_bot_token_here
177+
MONGO_URI=your_mongodb_connection_string
178+
```
179+
180+
2. **New Dependencies**
181+
```bash
182+
# Install updated requirements
183+
pip install -r requirements.txt
184+
```
185+
186+
3. **Database Migration**
187+
```bash
188+
# No database schema changes required
189+
# Existing data will work with new version
190+
```
191+
192+
4. **Configuration Updates**
193+
- Update imports to use `config.py` instead of `constants.py`
194+
- Set up admin user IDs in environment variables
195+
- Configure feature flags as needed
196+
197+
### Breaking Changes
198+
199+
- **Environment Variables**: Bot token and database URI must now be set via environment variables
200+
- **Admin Commands**: Analytics command now requires admin permissions
201+
- **Configuration**: Direct import of constants replaced with config module
202+
203+
## Support 💬
204+
205+
For help with upgrades or migration:
206+
- 📱 Telegram: [@DevIncognito](https://t.me/DevIncognito)
207+
- 📢 Updates: [@incognitobots](https://t.me/incognitobots)
208+
- 🐛 Issues: [GitHub Issues](https://github.com/KunalG932/PostBot/issues)
209+
210+
---
211+
212+
**Made with ❤️ by [@KunalG932](https://github.com/KunalG932)**

0 commit comments

Comments
 (0)