A Telegram bot that helps users discover interesting places nearby. The bot includes a separate admin interface for monitoring usage statistics.
- Discover nearby tourist attractions, landmarks, and points of interest
- Get detailed information about places including:
- Historical descriptions
- Audio narration
- Distance information
- Address details
- Walking directions
- Place photos
- Automatic translation of place names and descriptions
- Support for various tourist attraction types:
- Museums and Art Galleries
- Religious Sites (Churches, Temples, Mosques, Synagogues)
- Parks and Nature Areas
- Tourist Attractions and Landmarks
- Cultural Sites
- Customizable place preferences
- Multi-language support (English and Russian)
- Monitor bot usage statistics
- View active users
- See which cities the bot has been used in
- Create database backups
- Test API connections
- Debug system information
/street_spirit
├── app/
│ ├── handlers/
│ │ ├── __init__.py # Router and shared data
│ │ ├── state.py # Shared state and constants
│ │ ├── common.py # Common utilities
│ │ ├── start.py # Start and language commands
│ │ ├── places.py # Place preferences handling
│ │ └── location.py # Location and place discovery
│ ├── __init__.py # App initialization
│ ├── google_maps.py # Google Maps API integration
│ ├── languages.py # Language management
│ └── database.py # Database operations
├── run.py # Main bot entry point
├── admin_bot.py # Admin bot entry point
├── run_all.py # Run both bots together
├── requirements.txt # Project dependencies
├── setup.py # Package configuration
└── .env # Environment variables (not in repo)
-
Clone the repository:
git clone <repository-url> cd street_spirit
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Unix/macOS # or .venv\Scripts\activate # On Windows
-
Install the package in development mode:
pip install -e . -
Install required dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the project root with your API keys:# Telegram Tokens TG_TOKEN=your_main_bot_token ADMIN_BOT_TOKEN=your_admin_bot_token # API Keys GOOGLE_MAPS_API_KEY=your_google_maps_api_key DEEPSEEK_API_KEY=your_deepseek_api_key YA_SPEECHKIT_API_KEY=your_yandex_speechkit_key # Admin Access ADMIN_PASSWORD=your_secure_password # Database DB_PATH=bot_stats.db -
Add your Telegram user ID to
app/__init__.pyin theAUTHORIZED_ADMIN_IDSlist for automatic admin access.
python run_all.pyStart the main Tourist Guide Bot:
python run.pyStart the Admin Bot:
python admin_bot.py- Start a chat with your bot on Telegram
- Send the
/startcommand and select your preferred language - Use
/placesto customize your place preferences (optional) - Share your location to find nearby attractions
- For each place you'll get:
- A brief description
- Historical information
- Photos (if available)
- Walking directions
- Google Maps link
- Use the navigation buttons to:
- Get more details about the place
- See it on Google Maps
- Move to the next place
- Return to the first place
- Start a chat with your admin bot on Telegram
- Send the
/startcommand - If your Telegram user ID is in the authorized list, you'll get immediate access
- Otherwise, enter the admin password from your
.envfile - Use these commands to manage the bot:
/stats- View basic usage statistics/users- View recent active users/cities- View cities where the bot has searched/backup- Create a database backup/test_api- Test API connections/debug- Show technical debugging information/help- Show available commands
- Google Maps Places API: For finding nearby places and place details
- Google Maps Directions API: For walking directions
- Google Maps Geocoding API: For address lookup
- DeepSeek API: For generating historical descriptions
- Yandex SpeechKit: For text-to-speech conversion
The bot includes several optimizations:
- Concurrent API requests using
asyncio.gather() - Request deduplication for API calls
- Rate limiting for expensive operations
- Efficient place data caching
- Modular code structure for better maintainability
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
[Add your preferred license information here]
Konstantin Pudan [pudan.me]