File size: 954 Bytes
5116a2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Test Telegram integration in HF Spaces environment
"""

import os
from services.telegram import send_telegram

# Simulate HF Spaces environment
os.environ['SPACE_ID'] = 'test-space-id'
os.environ['HF_SPACE_HOST'] = 'test.hf.space'

def test_hf_telegram():
    print("🧪 Testing Telegram in HF Spaces environment...")

    test_message = "🧪 HF Spaces Test Message - This should not actually send"

    try:
        send_telegram(test_message)
        print("✅ HF Spaces telegram handling works - no network errors!")
        return True
    except Exception as e:
        print(f"❌ Error: {e}")
        return False

if __name__ == "__main__":
    success = test_hf_telegram()
    if success:
        print("\n🎉 HF Spaces telegram integration is working correctly!")
        print("The bot will run without network errors in HF Spaces.")
    else:
        print("\n❌ HF Spaces telegram integration needs fixing.")