#!/usr/bin/env python3 """ Test script for DuckHunt Bot Run this to test the bot locally """ import asyncio import json import sys import os # Add src directory to path sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) from duckhuntbot import IRCBot async def test_bot(): """Test the bot initialization and basic functionality""" try: # Load config with open('config.json') as f: config = json.load(f) # Create bot instance bot = IRCBot(config) print("✅ Bot initialized successfully!") # Test database bot.db.save_player("testuser", {"coins": 100, "caught": 5}) data = bot.db.load_player("testuser") if data and data['coins'] == 100: print("✅ Database working!") else: print("❌ Database test failed!") # Test game logic player = bot.game.get_player("testuser") if player and 'coins' in player: print("✅ Game logic working!") else: print("❌ Game logic test failed!") print("🦆 DuckHunt Bot is ready to deploy!") return True except Exception as e: print(f"❌ Error: {e}") return False if __name__ == '__main__': success = asyncio.run(test_bot()) if not success: sys.exit(1)