measmonysuon commited on
Commit
0a3df67
·
verified ·
1 Parent(s): eb58b86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -11,6 +11,9 @@ BOT_TOKEN = '7484321656:AAExhpS7sOGMu2BCuPQrDjuXpY3sEQmBgfY'
11
  WEBHOOK_SECRET = 'A3%26c8%21jP%23xZ1v*Qw5kL%5E0tR%40u9%25yS6' # URL-encoded secret
12
  POWER_USER_ID = 75516649
13
 
 
 
 
14
  # Initialize the Telegram bot
15
  bot = telebot.TeleBot(BOT_TOKEN)
16
 
@@ -60,14 +63,14 @@ def handle_update():
60
  return jsonify({'status': 'ok'}), 200
61
 
62
  async def set_telegram_webhook():
63
- """Sets the webhook for the Telegram bot."""
64
  webhook_url = f"https://measmonysuon-flyingbird.hf.space/webhooks/{WEBHOOK_SECRET}"
65
  retry_attempts = 5
66
  retry_delay = 1 # seconds
67
 
68
  for attempt in range(retry_attempts):
69
  try:
70
- async with httpx.AsyncClient() as client:
71
  response = await client.post(
72
  f"https://api.telegram.org/bot{BOT_TOKEN}/setWebhook",
73
  data={"url": webhook_url},
 
11
  WEBHOOK_SECRET = 'A3%26c8%21jP%23xZ1v*Qw5kL%5E0tR%40u9%25yS6' # URL-encoded secret
12
  POWER_USER_ID = 75516649
13
 
14
+ # Proxy Configuration
15
+ PROXY_URL = 'http://eR3LhYeoZXNWhIp:clIvQ2hSkO5CtLl@107.180.131.170:58874'
16
+
17
  # Initialize the Telegram bot
18
  bot = telebot.TeleBot(BOT_TOKEN)
19
 
 
63
  return jsonify({'status': 'ok'}), 200
64
 
65
  async def set_telegram_webhook():
66
+ """Sets the webhook for the Telegram bot with proxy configuration."""
67
  webhook_url = f"https://measmonysuon-flyingbird.hf.space/webhooks/{WEBHOOK_SECRET}"
68
  retry_attempts = 5
69
  retry_delay = 1 # seconds
70
 
71
  for attempt in range(retry_attempts):
72
  try:
73
+ async with httpx.AsyncClient(proxies=PROXY_URL) as client:
74
  response = await client.post(
75
  f"https://api.telegram.org/bot{BOT_TOKEN}/setWebhook",
76
  data={"url": webhook_url},