Update bot.py
Browse files
bot.py
CHANGED
@@ -8,6 +8,19 @@ from telegram import Update
|
|
8 |
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext
|
9 |
|
10 |
import subprocess # to remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
# Logging setup
|
|
|
8 |
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext
|
9 |
|
10 |
import subprocess # to remove
|
11 |
+
import socket # maybe to remove
|
12 |
+
|
13 |
+
# maybe remove
|
14 |
+
# Force using Google's DNS
|
15 |
+
def set_dns():
|
16 |
+
try:
|
17 |
+
socket.setdefaulttimeout(5) # Set timeout for connections
|
18 |
+
socket.getaddrinfo("api.telegram.org", 443, proto=socket.IPPROTO_TCP) # Force resolution
|
19 |
+
print("DNS resolution successful!")
|
20 |
+
except Exception as e:
|
21 |
+
print(f"DNS resolution failed: {e}")
|
22 |
+
|
23 |
+
set_dns()
|
24 |
|
25 |
|
26 |
# Logging setup
|