Spaces:
Runtime error
Runtime error
Update telegram_bot.py
Browse files- telegram_bot.py +7 -6
telegram_bot.py
CHANGED
|
@@ -382,16 +382,17 @@ def main():
|
|
| 382 |
print("🚀 Starting Telegram Homeopathy Bot...")
|
| 383 |
|
| 384 |
# Create Application
|
| 385 |
-
# CRITICAL FIX:
|
| 386 |
application = (
|
| 387 |
Application.builder()
|
| 388 |
.token(TELEGRAM_TOKEN)
|
| 389 |
-
.
|
| 390 |
# Explicitly set low timeouts to force failures and retries faster if DNS fails
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
|
|
|
| 395 |
)
|
| 396 |
|
| 397 |
# Add conversation handler
|
|
|
|
| 382 |
print("🚀 Starting Telegram Homeopathy Bot...")
|
| 383 |
|
| 384 |
# Create Application
|
| 385 |
+
# CRITICAL FIX: The 'request_kwargs' must be passed to .build() method, not chained on the builder object.
|
| 386 |
application = (
|
| 387 |
Application.builder()
|
| 388 |
.token(TELEGRAM_TOKEN)
|
| 389 |
+
.build(
|
| 390 |
# Explicitly set low timeouts to force failures and retries faster if DNS fails
|
| 391 |
+
request_kwargs={
|
| 392 |
+
'connect_timeout': 5.0, # 5 seconds to establish connection
|
| 393 |
+
'read_timeout': 15.0 # 15 seconds to receive the first byte
|
| 394 |
+
}
|
| 395 |
+
)
|
| 396 |
)
|
| 397 |
|
| 398 |
# Add conversation handler
|