Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ class EventEmitter:
|
|
118 |
def make_telegram_request(method, data=None):
|
119 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/{method}"
|
120 |
if PHP_PROXY_URL:
|
121 |
-
url = f"{PHP_PROXY_URL}{
|
122 |
headers = {'Content-Type': 'application/json'}
|
123 |
if data:
|
124 |
data = json.dumps(data)
|
@@ -137,8 +137,8 @@ async def setBotCommands():
|
|
137 |
delete_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/deleteMyCommands"
|
138 |
set_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/setMyCommands"
|
139 |
if PHP_PROXY_URL:
|
140 |
-
delete_url = f"{PHP_PROXY_URL}
|
141 |
-
set_url = f"{PHP_PROXY_URL}
|
142 |
|
143 |
try:
|
144 |
delete_response = make_telegram_request('deleteMyCommands')
|
@@ -447,8 +447,8 @@ async def handleCallbackQuery(callbackQuery):
|
|
447 |
|
448 |
async def sendTelegramMessage(chatId, text, options={}):
|
449 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
450 |
-
if PHP_PROXY_URL:
|
451 |
-
url = f"{PHP_PROXY_URL}
|
452 |
data = {
|
453 |
'chat_id': chatId,
|
454 |
'text': text,
|
@@ -460,7 +460,6 @@ async def sendTelegramMessage(chatId, text, options={}):
|
|
460 |
except requests.exceptions.RequestException as e:
|
461 |
print(f'发送 Telegram 消息失败: {e}')
|
462 |
|
463 |
-
|
464 |
def getHelpMessage():
|
465 |
return f"""
|
466 |
可用指令:
|
|
|
118 |
def make_telegram_request(method, data=None):
|
119 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/{method}"
|
120 |
if PHP_PROXY_URL:
|
121 |
+
url = f"{PHP_PROXY_URL}{url.replace(f'https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}', '')}"
|
122 |
headers = {'Content-Type': 'application/json'}
|
123 |
if data:
|
124 |
data = json.dumps(data)
|
|
|
137 |
delete_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/deleteMyCommands"
|
138 |
set_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/setMyCommands"
|
139 |
if PHP_PROXY_URL:
|
140 |
+
delete_url = f"{PHP_PROXY_URL}{delete_url.replace(f'https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}', '')}"
|
141 |
+
set_url = f"{PHP_PROXY_URL}{set_url.replace(f'https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}', '')}"
|
142 |
|
143 |
try:
|
144 |
delete_response = make_telegram_request('deleteMyCommands')
|
|
|
447 |
|
448 |
async def sendTelegramMessage(chatId, text, options={}):
|
449 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
450 |
+
if PHP_PROXY_URL:
|
451 |
+
url = f"{PHP_PROXY_URL}{url.replace(f'https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}', '')}"
|
452 |
data = {
|
453 |
'chat_id': chatId,
|
454 |
'text': text,
|
|
|
460 |
except requests.exceptions.RequestException as e:
|
461 |
print(f'发送 Telegram 消息失败: {e}')
|
462 |
|
|
|
463 |
def getHelpMessage():
|
464 |
return f"""
|
465 |
可用指令:
|