Spaces:
Paused
Paused
Download Telegram_Job_Bot/fix_hf_chat.py from telegramjobupload/README: direct link, hf CLI and curl.
- Browser
- Download file 983 Bytes
-
https://huggingface.co/spaces/telegramjobupload/README/resolve/main/Telegram_Job_Bot/fix_hf_chat.py
- Command line
-
hf download hf://spaces/telegramjobupload/README/Telegram_Job_Bot/fix_hf_chat.py
-
curl -L -o fix_hf_chat.py https://huggingface.co/spaces/telegramjobupload/README/resolve/main/Telegram_Job_Bot/fix_hf_chat.py
983 Bytes
| import re | |
| # Fix main.py | |
| try: | |
| with open('main.py', 'r', encoding='utf-8') as f: | |
| content = f.read() | |
| old_chat = 'data = safe_load_json(CHAT_ID_FILE, {})\\n return data.get("chat_id")' | |
| new_chat = 'data = safe_load_json(CHAT_ID_FILE, {})\\n return data.get("chat_id", "7607565831")' | |
| content = content.replace(old_chat, new_chat) | |
| with open('main.py', 'w', encoding='utf-8') as f: | |
| f.write(content) | |
| except Exception as e: print("main:", e) | |
| # Fix job_radar.py | |
| try: | |
| with open('job_radar.py', 'r', encoding='utf-8') as f: | |
| content = f.read() | |
| old_radar_chat = 'chat_id = os.getenv("TELEGRAM_CHAT_ID")' | |
| new_radar_chat = 'chat_id = os.getenv("TELEGRAM_CHAT_ID", "7607565831")' | |
| content = content.replace(old_radar_chat, new_radar_chat) | |
| with open('job_radar.py', 'w', encoding='utf-8') as f: | |
| f.write(content) | |
| except Exception as e: print("radar:", e) | |
| print("Chat ID hardcoded for HF") | |