File size: 476 Bytes
99fb140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
import requests

# Get your Space URL from Hugging Face
# Example: https://yourusername-mileage-tracker.hf.space
SPACE_URL = "https://yukee1992-mileage-tracker.hf.space"  # CHANGE THIS
TELEGRAM_TOKEN = "YOUR_BOT_TOKEN"  # CHANGE THIS

# Set webhook
webhook_url = f"{SPACE_URL}/webhook/{TELEGRAM_TOKEN}"
response = requests.post(
    f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/setWebhook",
    json={"url": webhook_url}
)

print(f"Webhook set: {response.json()}")