π AutoCare System β A Telegram bot that helps users find nearby auto services and car washes in Uzbekistan using location-based search.
- π Location-Based Search: Find nearest autoservices and carwashes based on your location
- πΊοΈ Map Integration: View locations on Google Maps
- βοΈ Service Filters: Filter by specific services (electrical, body work, tire services, etc.)
- π Working Hours: See operating hours and 24/7 availability
- π Direct Contact: Call services directly from Telegram
- πΊπΏ Uzbek Language: Interface in Uzbek language
- Python 3.12+
- aiogram 3.22.0 - Modern Telegram Bot framework
- PostgreSQL - Database for storing service locations
- asyncpg - Async PostgreSQL driver
- python-dotenv - Environment variable management
- Python 3.12 or higher
- PostgreSQL database
- Telegram Bot Token (from @BotFather)
git clone https://github.com/PharmaUz/AutoCare.git
cd AutoCareUsing pip:
pip install -r requirements.txtOr using pipenv:
pipenv installCreate a .env file in the project root:
cp .env.example .envEdit .env with your configuration:
# Bot Configuration
BOT_TOKEN=your_bot_token_here
# Admin Settings
ADMINS=123456789,987654321
ADMIN_GROUP_ID=-1002765600267
# Network Settings
IP=localhost
# Database Configuration
DATABASE_URL=postgresql://user:password@host:port/databaseRun the migration script to create tables and populate initial data:
python migrate.pypython app.pyAutoCare/
βββ app.py # Main application entry point
βββ database.py # Database operations and queries
βββ loader.py # Bot and dispatcher initialization
βββ migrate.py # Database migration script
βββ requirements.txt # Python dependencies
βββ Pipfile # Pipenv configuration
βββ .env.example # Environment variables template
βββ data/ # Configuration and data
β βββ config.py # App configuration
β βββ locations.py # Location data
βββ handlers/ # Message and callback handlers
β βββ __init__.py
β βββ users/ # User-facing handlers
β β βββ start.py # /start command
β β βββ menuHendlers.py # Menu navigation
β β βββ locations_hendler.py # Location processing
β βββ errors/ # Error handlers
β βββ error_handler.py
βββ keyboards/ # Keyboard layouts
β βββ inline/ # Inline keyboards
β βββ default/ # Reply keyboards
βββ middlewares/ # Bot middlewares
β βββ rate_limit.py # Rate limiting
βββ utils/ # Utility functions
β βββ misc/
β βββ get_distance.py # Distance calculations
β βββ logging.py # Logging configuration
βββ states/ # FSM states
βββ security/ # Security documentation
βββ security-checklist.md # Security review checklist
id- Unique identifiername- Service namelat,lon- GPS coordinatesaddress- Full addressphone- Contact phoneservices- Available services (JSONB)working_days- Working days (array)working_hours- Operating hours (JSONB)is_24_7- 24/7 availability flag
Same structure as autoservice
- Start the bot: Send
/startto your bot - Choose service type: Select "Avtoservis" or "Avtomoyka"
- Select service category (for autoservices)
- Share your location
- View nearby results with details
- Tap on location to view on map or contact the service
- Prevents spam by limiting requests to 1 per second for messages
- Callback queries limited to 0.5 seconds
- Automatic rate limit notifications
- Validates GPS coordinates
- Sanitizes user inputs
- Validates callback data
- Connection pooling (1-10 connections)
- Parameterized queries for security
- Haversine formula for accurate distance calculation
- Indexed columns for fast queries
- Comprehensive error catching
- User-friendly error messages
- Detailed logging for debugging
This project follows security best practices:
- β Parameterized database queries (SQL injection prevention)
- β Environment variables for sensitive data
- β Input validation and sanitization
- β Rate limiting to prevent abuse
- β Coordinate validation
- β Secure error handling
See security/security-checklist.md for complete security guidelines.
- Update
data/locations.pywith new service data - Run migration:
python migrate.py
Currently, there is no automated test suite. Manual testing recommended:
# Test database connection
python database.py- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Open an issue on GitHub
- Contact the maintainers
- Add admin panel
- Implement user reviews and ratings
- Add fuel delivery service
- Add anti-theft system integration
- Multi-language support (Russian, English)
- Service booking system
- Push notifications
- Statistics and analytics
- PharmaUz Team - Initial work
- aiogram community for the excellent framework
- Contributors and testers