fix: replace emoji characters with ASCII-safe markers for Windows compatibility
- Replace Unicode emoji (✓, ⚠️) with [OK] and [WARN] in audio_preprocessor.py
to prevent UnicodeEncodeError on Windows console (cp1252 codec)
- Add auto-update dependencies function to bot.py for easier maintenance
- Remove setup_linux.sh (no longer needed)
- Update .gitignore to exclude VS Code launch.json
This commit is contained in:
22
bot.py
22
bot.py
@@ -1,6 +1,8 @@
|
||||
import numba_config
|
||||
import asyncio
|
||||
import io
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
@@ -365,7 +367,27 @@ class TTSBot(commands.Bot):
|
||||
return None
|
||||
|
||||
|
||||
def auto_update_dependencies() -> None:
|
||||
"""Auto-update pip packages on startup."""
|
||||
try:
|
||||
print("Checking for package updates...")
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-m", "pip", "install", "-r", "requirements.txt", "-U", "-q"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False
|
||||
)
|
||||
if result.returncode == 0:
|
||||
print("Packages updated successfully (or already up to date)")
|
||||
else:
|
||||
print(f"Warning: Package update had issues: {result.stderr}")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not auto-update packages: {e}")
|
||||
|
||||
|
||||
def main():
|
||||
auto_update_dependencies()
|
||||
|
||||
errors = Config.validate()
|
||||
if errors:
|
||||
print("Configuration errors:")
|
||||
|
||||
Reference in New Issue
Block a user