Spaces:
Runtime error
Runtime error
Vinoth-46 commited on
Commit ·
3c08c2a
1
Parent(s): 1a181b2
Final attempt with official API and 60s timeout
Browse files- scripts/telegram_bot.py +6 -9
scripts/telegram_bot.py
CHANGED
|
@@ -55,20 +55,17 @@ class ProductionBot:
|
|
| 55 |
logger.error("❌ TELEGRAM_BOT_TOKEN is MISSING in environment variables!")
|
| 56 |
raise ValueError("TELEGRAM_BOT_TOKEN not found. Did you set it in Hugging Face Secrets?")
|
| 57 |
|
| 58 |
-
#
|
| 59 |
-
proxy_url = "https://tg.i-c-a.su/bot/"
|
| 60 |
-
|
| 61 |
-
# Safety: Strip any accidental spaces from the token
|
| 62 |
token = config.TELEGRAM_BOT_TOKEN.strip().replace(" ", "")
|
| 63 |
|
| 64 |
self.app = (
|
| 65 |
Application.builder()
|
| 66 |
.token(token)
|
| 67 |
-
.
|
| 68 |
-
.
|
| 69 |
-
.
|
| 70 |
-
.
|
| 71 |
-
.
|
| 72 |
.build()
|
| 73 |
)
|
| 74 |
self.chat_id = config.TELEGRAM_CHAT_ID
|
|
|
|
| 55 |
logger.error("❌ TELEGRAM_BOT_TOKEN is MISSING in environment variables!")
|
| 56 |
raise ValueError("TELEGRAM_BOT_TOKEN not found. Did you set it in Hugging Face Secrets?")
|
| 57 |
|
| 58 |
+
# Reverting to official API but with an even longer 60s timeout
|
|
|
|
|
|
|
|
|
|
| 59 |
token = config.TELEGRAM_BOT_TOKEN.strip().replace(" ", "")
|
| 60 |
|
| 61 |
self.app = (
|
| 62 |
Application.builder()
|
| 63 |
.token(token)
|
| 64 |
+
.connect_timeout(60)
|
| 65 |
+
.read_timeout(60)
|
| 66 |
+
.write_timeout(60)
|
| 67 |
+
.pool_timeout(60)
|
| 68 |
+
.get_updates_read_timeout(60)
|
| 69 |
.build()
|
| 70 |
)
|
| 71 |
self.chat_id = config.TELEGRAM_CHAT_ID
|