Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
89
test_bot.py
Normal file
89
test_bot.py
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Simple test to verify the bot can be initialized without errors."""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
|
||||
# Add the project root to the path
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Setup logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler("data/test_bot.log"),
|
||||
logging.StreamHandler(sys.stdout)
|
||||
]
|
||||
)
|
||||
logger = logging.getLogger('TestBot')
|
||||
|
||||
def test_imports():
|
||||
"""Test that all required modules can be imported."""
|
||||
try:
|
||||
from core.bot import Superviseur
|
||||
from core.llm import LLMManager
|
||||
from dotenv import load_dotenv
|
||||
import discord
|
||||
logger.info("✓ All imports successful")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"✗ Import failed: {e}")
|
||||
return False
|
||||
|
||||
def test_llm_manager():
|
||||
"""Test LLMManager initialization."""
|
||||
try:
|
||||
from core.llm import LLMManager
|
||||
llm = LLMManager(model_name="beta-20b")
|
||||
logger.info("✓ LLMManager initialized successfully")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"✗ LLMManager failed: {e}")
|
||||
return False
|
||||
|
||||
def test_bot_initialization():
|
||||
"""Test Superviseur bot initialization."""
|
||||
try:
|
||||
from core.bot import Superviseur
|
||||
import discord
|
||||
from core.llm import LLMManager
|
||||
|
||||
# Create a mock LLMManager
|
||||
llm = LLMManager(model_name="beta-20b")
|
||||
|
||||
# Create minimal intents
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
intents.members = True
|
||||
intents.voice_states = True
|
||||
|
||||
# Try to initialize the bot (without actually connecting)
|
||||
bot = Superviseur(
|
||||
llama_model=llm,
|
||||
command_prefix="!",
|
||||
guild_id=123456789,
|
||||
system_prompt="Test system prompt",
|
||||
intents=intents
|
||||
)
|
||||
logger.info("✓ Superviseur bot initialized successfully")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"✗ Bot initialization failed: {e}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
logger.info("Testing bot initialization...")
|
||||
|
||||
success = True
|
||||
success &= test_imports()
|
||||
success &= test_llm_manager()
|
||||
success &= test_bot_initialization()
|
||||
|
||||
if success:
|
||||
logger.info("✓ All tests passed! Bot should be able to run.")
|
||||
sys.exit(0)
|
||||
else:
|
||||
logger.error("✗ Some tests failed.")
|
||||
sys.exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue