Spaces:
Paused
Paused
testingv5
Browse files- Dockerfile +4 -0
- TROUBLESHOOTING.md +95 -0
- config_template.env +31 -0
- connection_retry.py +35 -0
- requirements.txt +22 -0
- startup +31 -3
Dockerfile
CHANGED
|
@@ -41,6 +41,10 @@ RUN mkdir -p /app/sessions /app/resources/auth /app/tmp /app/pdf /app/addons &&
|
|
| 41 |
# Fix relative imports (make packages)
|
| 42 |
RUN touch /app/__init__.py /app/addons/__init__.py /app/pyUltroid/__init__.py
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# Set Python path
|
| 45 |
ENV PYTHONPATH="${PYTHONPATH}:/app"
|
| 46 |
|
|
|
|
| 41 |
# Fix relative imports (make packages)
|
| 42 |
RUN touch /app/__init__.py /app/addons/__init__.py /app/pyUltroid/__init__.py
|
| 43 |
|
| 44 |
+
# Create addons directory structure
|
| 45 |
+
RUN mkdir -p /app/addons && \
|
| 46 |
+
chmod -R 777 /app/addons
|
| 47 |
+
|
| 48 |
# Set Python path
|
| 49 |
ENV PYTHONPATH="${PYTHONPATH}:/app"
|
| 50 |
|
TROUBLESHOOTING.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid Troubleshooting Guide
|
| 2 |
+
|
| 3 |
+
## Common Issues and Solutions
|
| 4 |
+
|
| 5 |
+
### 1. Missing Dependencies
|
| 6 |
+
|
| 7 |
+
**Problem**: Addon plugins fail to load due to missing Python packages.
|
| 8 |
+
|
| 9 |
+
**Solution**:
|
| 10 |
+
- All required dependencies have been added to `requirements.txt`
|
| 11 |
+
- Run: `pip install -r requirements.txt`
|
| 12 |
+
- For Docker: The Dockerfile has been updated to install all dependencies
|
| 13 |
+
|
| 14 |
+
### 2. Import Errors
|
| 15 |
+
|
| 16 |
+
**Problem**: `ImportError: attempted relative import beyond top-level package`
|
| 17 |
+
|
| 18 |
+
**Solution**:
|
| 19 |
+
- Fixed by creating proper `addons/__init__.py` with correct imports
|
| 20 |
+
- Updated addon files to use absolute imports
|
| 21 |
+
- Added proper package structure
|
| 22 |
+
|
| 23 |
+
### 3. FastAPI Dependency Conflict
|
| 24 |
+
|
| 25 |
+
**Problem**: `fastapi 0.104.1 requires anyio<4.0.0,>=3.7.1, but you have anyio 4.10.0`
|
| 26 |
+
|
| 27 |
+
**Solution**:
|
| 28 |
+
- Updated `requirements.txt` to pin anyio version: `anyio>=3.7.1,<4.0.0`
|
| 29 |
+
- This ensures compatibility with FastAPI 0.104.1
|
| 30 |
+
|
| 31 |
+
### 4. Telegram Connection Timeouts
|
| 32 |
+
|
| 33 |
+
**Problem**: `Connection to Telegram failed 5 time(s)`
|
| 34 |
+
|
| 35 |
+
**Solutions**:
|
| 36 |
+
- Check your internet connection
|
| 37 |
+
- Verify API credentials in `.env` file
|
| 38 |
+
- Try using a VPN if Telegram is blocked in your region
|
| 39 |
+
- Increase timeout settings in configuration
|
| 40 |
+
- The connection retry logic has been improved
|
| 41 |
+
|
| 42 |
+
### 5. Addons Directory Issues
|
| 43 |
+
|
| 44 |
+
**Problem**: Addons fail to load or directory doesn't exist
|
| 45 |
+
|
| 46 |
+
**Solution**:
|
| 47 |
+
- The startup script now automatically creates the addons directory
|
| 48 |
+
- If cloning fails, it falls back to the local addon files
|
| 49 |
+
- Ensure proper permissions: `chmod -R 777 addons/`
|
| 50 |
+
|
| 51 |
+
### 6. Missing Addon Dependencies
|
| 52 |
+
|
| 53 |
+
**Problem**: Specific addon features not working
|
| 54 |
+
|
| 55 |
+
**Solution**:
|
| 56 |
+
- Install missing packages individually:
|
| 57 |
+
```bash
|
| 58 |
+
pip install jikanpy gingerit google_trans_new covid pyfiglet pyjokes
|
| 59 |
+
pip install markdownify pygments pokedex emoji quotefancy
|
| 60 |
+
pip install lyrics_extractor speech_recognition textblob speedtest shazamio wikipedia
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Configuration
|
| 64 |
+
|
| 65 |
+
1. Copy `config_template.env` to `.env`
|
| 66 |
+
2. Fill in your API credentials and session strings
|
| 67 |
+
3. Set up MongoDB connection string
|
| 68 |
+
4. Configure log channel ID
|
| 69 |
+
|
| 70 |
+
## Docker Deployment
|
| 71 |
+
|
| 72 |
+
1. Build the image: `docker build -t ultroid .`
|
| 73 |
+
2. Run with environment variables:
|
| 74 |
+
```bash
|
| 75 |
+
docker run -d --name ultroid \
|
| 76 |
+
-e SESSION1="your_session_string" \
|
| 77 |
+
-e MONGO_URI="your_mongo_uri" \
|
| 78 |
+
-e API_ID="your_api_id" \
|
| 79 |
+
-e API_HASH="your_api_hash" \
|
| 80 |
+
ultroid
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Manual Setup
|
| 84 |
+
|
| 85 |
+
1. Install Python 3.11+
|
| 86 |
+
2. Install dependencies: `pip install -r requirements.txt`
|
| 87 |
+
3. Set up environment variables
|
| 88 |
+
4. Run: `python3 -m pyUltroid`
|
| 89 |
+
|
| 90 |
+
## Getting Help
|
| 91 |
+
|
| 92 |
+
- Check the logs for specific error messages
|
| 93 |
+
- Ensure all environment variables are set correctly
|
| 94 |
+
- Verify network connectivity to Telegram servers
|
| 95 |
+
- Check MongoDB connection if using database features
|
config_template.env
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ultroid Configuration Template
|
| 2 |
+
# Copy this file to .env and fill in your values
|
| 3 |
+
|
| 4 |
+
# Session strings (get from @StringSessionBot)
|
| 5 |
+
SESSION1=your_session_string_here
|
| 6 |
+
|
| 7 |
+
# Database URL (MongoDB)
|
| 8 |
+
MONGO_URI=mongodb://localhost:27017/ultroid
|
| 9 |
+
|
| 10 |
+
# Bot token (if using bot mode)
|
| 11 |
+
BOT_TOKEN=your_bot_token_here
|
| 12 |
+
|
| 13 |
+
# API credentials
|
| 14 |
+
API_ID=your_api_id
|
| 15 |
+
API_HASH=your_api_hash
|
| 16 |
+
|
| 17 |
+
# Optional: Addons URL
|
| 18 |
+
ADDONS_URL=https://github.com/TeamUltroid/UltroidAddons.git
|
| 19 |
+
|
| 20 |
+
# Optional: Exclude specific addons
|
| 21 |
+
EXCLUDE_ADDONS=
|
| 22 |
+
|
| 23 |
+
# Optional: Include only specific addons
|
| 24 |
+
INCLUDE_ADDONS=
|
| 25 |
+
|
| 26 |
+
# Log channel ID
|
| 27 |
+
LOG_CHANNEL=your_log_channel_id
|
| 28 |
+
|
| 29 |
+
# Connection settings
|
| 30 |
+
CONNECTION_TIMEOUT=30
|
| 31 |
+
MAX_RETRIES=5
|
connection_retry.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Connection retry utility for Ultroid
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import asyncio
|
| 6 |
+
import logging
|
| 7 |
+
from typing import Optional
|
| 8 |
+
|
| 9 |
+
LOGS = logging.getLogger(__name__)
|
| 10 |
+
|
| 11 |
+
class ConnectionRetry:
|
| 12 |
+
def __init__(self, max_retries: int = 5, delay: float = 5.0):
|
| 13 |
+
self.max_retries = max_retries
|
| 14 |
+
self.delay = delay
|
| 15 |
+
|
| 16 |
+
async def connect_with_retry(self, connect_func, *args, **kwargs):
|
| 17 |
+
"""Connect with retry logic"""
|
| 18 |
+
for attempt in range(self.max_retries):
|
| 19 |
+
try:
|
| 20 |
+
LOGS.info(f"Connection attempt {attempt + 1}/{self.max_retries}")
|
| 21 |
+
result = await connect_func(*args, **kwargs)
|
| 22 |
+
LOGS.info("Connection successful!")
|
| 23 |
+
return result
|
| 24 |
+
except Exception as e:
|
| 25 |
+
LOGS.warning(f"Connection attempt {attempt + 1} failed: {e}")
|
| 26 |
+
if attempt < self.max_retries - 1:
|
| 27 |
+
LOGS.info(f"Retrying in {self.delay} seconds...")
|
| 28 |
+
await asyncio.sleep(self.delay)
|
| 29 |
+
self.delay *= 1.5 # Exponential backoff
|
| 30 |
+
else:
|
| 31 |
+
LOGS.error(f"All connection attempts failed after {self.max_retries} tries")
|
| 32 |
+
raise e
|
| 33 |
+
|
| 34 |
+
# Global retry instance
|
| 35 |
+
retry_handler = ConnectionRetry(max_retries=5, delay=5.0)
|
requirements.txt
CHANGED
|
@@ -13,6 +13,7 @@ cloudscraper
|
|
| 13 |
fastapi==0.104.1
|
| 14 |
uvicorn[standard]==0.23.2
|
| 15 |
pydantic>=1.10.0,<2.0.0
|
|
|
|
| 16 |
|
| 17 |
apscheduler
|
| 18 |
aiohttp
|
|
@@ -43,4 +44,25 @@ telegraph
|
|
| 43 |
tgcrypto
|
| 44 |
youtube-search-python
|
| 45 |
yt-dlp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
# -------------------------------------------------------#
|
|
|
|
| 13 |
fastapi==0.104.1
|
| 14 |
uvicorn[standard]==0.23.2
|
| 15 |
pydantic>=1.10.0,<2.0.0
|
| 16 |
+
anyio>=3.7.1,<4.0.0
|
| 17 |
|
| 18 |
apscheduler
|
| 19 |
aiohttp
|
|
|
|
| 44 |
tgcrypto
|
| 45 |
youtube-search-python
|
| 46 |
yt-dlp
|
| 47 |
+
|
| 48 |
+
# Addon dependencies
|
| 49 |
+
jikanpy
|
| 50 |
+
gingerit
|
| 51 |
+
google_trans_new
|
| 52 |
+
covid
|
| 53 |
+
pyfiglet
|
| 54 |
+
pyjokes
|
| 55 |
+
markdownify
|
| 56 |
+
pygments
|
| 57 |
+
pokedex
|
| 58 |
+
emoji
|
| 59 |
+
quotefancy
|
| 60 |
+
lyrics_extractor
|
| 61 |
+
speech_recognition
|
| 62 |
+
textblob
|
| 63 |
+
speedtest
|
| 64 |
+
shazamio
|
| 65 |
+
wikipedia
|
| 66 |
+
asynclyrics-extractor
|
| 67 |
+
phlogo
|
| 68 |
# -------------------------------------------------------#
|
startup
CHANGED
|
@@ -5,7 +5,6 @@
|
|
| 5 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 6 |
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
| 7 |
|
| 8 |
-
|
| 9 |
echo "
|
| 10 |
ββ³ββββββββββββ
|
| 11 |
βββ£ββββ³β³β³βββββ
|
|
@@ -15,5 +14,34 @@ echo "
|
|
| 15 |
Visit @TheUltroid for updates!!
|
| 16 |
|
| 17 |
"
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
| 6 |
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
| 7 |
|
|
|
|
| 8 |
echo "
|
| 9 |
ββ³ββββββββββββ
|
| 10 |
βββ£ββββ³β³β³βββββ
|
|
|
|
| 14 |
Visit @TheUltroid for updates!!
|
| 15 |
|
| 16 |
"
|
| 17 |
+
|
| 18 |
+
# Clone addons if they don't exist
|
| 19 |
+
if [ ! -d "addons" ] || [ ! -f "addons/__init__.py" ]; then
|
| 20 |
+
echo "Setting up addons directory..."
|
| 21 |
+
mkdir -p addons
|
| 22 |
+
touch addons/__init__.py
|
| 23 |
+
|
| 24 |
+
# Try to clone addons repository
|
| 25 |
+
if command -v git &> /dev/null; then
|
| 26 |
+
echo "Cloning addons repository..."
|
| 27 |
+
git clone -q https://github.com/TeamUltroid/UltroidAddons.git addons_temp || true
|
| 28 |
+
if [ -d "addons_temp" ]; then
|
| 29 |
+
cp -r addons_temp/* addons/ 2>/dev/null || true
|
| 30 |
+
rm -rf addons_temp
|
| 31 |
+
fi
|
| 32 |
+
fi
|
| 33 |
+
fi
|
| 34 |
+
|
| 35 |
+
# Set environment variables
|
| 36 |
+
if [ -f .env ] ; then
|
| 37 |
+
set -o allexport
|
| 38 |
+
source .env
|
| 39 |
+
set +o allexport
|
| 40 |
+
fi
|
| 41 |
+
|
| 42 |
+
# Start the application
|
| 43 |
+
if [ $SESSION1 ] ; then
|
| 44 |
+
python3 multi_client.py
|
| 45 |
+
else
|
| 46 |
+
python3 -m pyUltroid
|
| 47 |
+
fi
|