Spaces:
Paused
Paused
| #!/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.") | |