attendantelectro commited on
Commit
36173b1
·
verified ·
1 Parent(s): 4df7aff

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +9 -10
entrypoint.sh CHANGED
@@ -1,12 +1,11 @@
1
- import requests
2
- import os
3
 
4
- TOKEN = os.getenv("TELEGRAM_TOKEN")
5
- SPACE_URL = os.getenv("SPACE_URL", "https://attendantelectro-bot.hf.space") # آدرس Space خود را قرار دهید
 
 
 
 
6
 
7
- url = f"https://api.telegram.org/bot{TOKEN}/setWebhook"
8
- params = {
9
- "url": f"{SPACE_URL}/webhook"
10
- }
11
- response = requests.post(url, json=params)
12
- print("Webhook set response:", response.json())
 
1
+ #!/bin/bash
 
2
 
3
+ # اجرا کردن set_webhook.py فقط یک بار
4
+ if [ ! -f "/app/webhook_set.lock" ]; then
5
+ echo "Setting up Telegram webhook..."
6
+ python /app/set_webhook.py
7
+ touch /app/webhook_set.lock
8
+ fi
9
 
10
+ # اجرا کردن سرور FastAPI
11
+ exec uvicorn app:app --host 0.0.0.0 --port 7860