File size: 2,587 Bytes
4c75d73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
"""

Test script for Read2Burn mailbox functionality

"""

import sys
import os

# Add the src directory to Python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

def test_read2burn():
    try:
        from src.addons.read2burn_addon import read2burn_service
        
        print("🧪 Testing Read2Burn Mailbox...")
        
        # Test player ID
        player_id = "test_player_123"
        
        print("\n📝 Testing Message Creation...")
        # Test creating messages
        result1 = read2burn_service.handle_command(player_id, "create This is a secret message!")
        print(f"📤 Create command result: {result1}")
        
        result2 = read2burn_service.handle_command(player_id, "create Another confidential note")
        print(f"📤 Create command result: {result2}")
        
        print("\n📋 Testing Message Listing...")
        # Test listing messages
        list_result = read2burn_service.handle_command(player_id, "list")
        print(f"📜 List command result: {list_result}")
        
        print("\n📖 Testing Message Reading...")
        # Extract message ID from first create result to test reading
        import re
        match = re.search(r'Message ID:\*\* `([^`]+)`', result1)
        if match:
            message_id = match.group(1)
            print(f"🔍 Found message ID: {message_id}")
            
            # Test reading the message
            read_result = read2burn_service.handle_command(player_id, f"read {message_id}")
            print(f"📖 Read command result: {read_result}")
            
            # Try to read again (should be burned)
            read_again = read2burn_service.handle_command(player_id, f"read {message_id}")
            print(f"🔥 Read again result: {read_again}")
        
        print("\n❓ Testing Help Command...")
        help_result = read2burn_service.handle_command(player_id, "help")
        print(f"💡 Help command result: {help_result}")
        
        print("\n📊 Testing Message History...")
        history = read2burn_service.get_player_message_history(player_id)
        print(f"📈 Message history: {len(history)} entries")
        for entry in history:
            print(f"  - {entry}")
        
        print("\n✅ Read2Burn test completed successfully!")
        
    except Exception as e:
        print(f"❌ Test failed: {e}")
        import traceback
        traceback.print_exc()

if __name__ == "__main__":
    test_read2burn()