#!/usr/bin/env python3 """ Test script for enhanced chat features (emotes, commands) """ import sys import os # Add the src directory to Python path sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) def test_enhanced_chat(): try: from src.core.game_engine import get_game_engine from src.facades.game_facade import GameFacade print("๐Ÿงช Testing Enhanced Chat Features...") # Get game instances facade = GameFacade() # Add test player player_id = facade.join_game('ChatTester') print(f"โœ… Created player: {player_id}") print("\n๐ŸŽญ Testing Emotes...") # Test emote processing emote_messages = [ "Hello :smile: everyone!", "This is :fire: amazing!", "Good job :thumbsup: team!", ":wave: Hey there :heart:" ] for msg in emote_messages: success = facade.send_chat_message(player_id, msg) print(f"๐Ÿ“ค Emote message '{msg}' sent: {success}") print("\n๐Ÿ”ง Testing Chat Commands...") # Test chat commands commands = [ "/help", "/emotes", "/channels", "/time", "/invalid_command" ] for cmd in commands: success = facade.send_chat_message(player_id, cmd) print(f"โšก Command '{cmd}' sent: {success}") print("\n๐Ÿ“œ Recent Chat History:") chat_history = facade.get_chat_history(10) for i, msg in enumerate(chat_history[-10:], 1): sender = msg.get('sender', 'Unknown') message = msg.get('message', '') msg_type = msg.get('type', 'unknown') print(f" {i}. [{msg_type}] {sender}: {message}") print("\nโœ… Enhanced chat test completed successfully!") except Exception as e: print(f"โŒ Test failed: {e}") import traceback traceback.print_exc() if __name__ == "__main__": test_enhanced_chat()