Update app.py
Browse files
app.py
CHANGED
|
@@ -118,7 +118,8 @@ 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 |
-
|
|
|
|
| 122 |
headers = {'Content-Type': 'application/json'}
|
| 123 |
if data:
|
| 124 |
data = json.dumps(data)
|
|
@@ -137,8 +138,10 @@ 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 |
-
|
| 141 |
-
|
|
|
|
|
|
|
| 142 |
|
| 143 |
try:
|
| 144 |
delete_response = make_telegram_request('deleteMyCommands')
|
|
@@ -448,7 +451,8 @@ async def handleCallbackQuery(callbackQuery):
|
|
| 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 |
-
|
|
|
|
| 452 |
data = {
|
| 453 |
'chat_id': chatId,
|
| 454 |
'text': text,
|
|
|
|
| 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 |
+
method_name = url.split('/')[-1]
|
| 122 |
+
url = f"{PHP_PROXY_URL}{method_name}"
|
| 123 |
headers = {'Content-Type': 'application/json'}
|
| 124 |
if data:
|
| 125 |
data = json.dumps(data)
|
|
|
|
| 138 |
delete_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/deleteMyCommands"
|
| 139 |
set_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/setMyCommands"
|
| 140 |
if PHP_PROXY_URL:
|
| 141 |
+
delete_method_name = delete_url.split('/')[-1]
|
| 142 |
+
set_method_name = set_url.split('/')[-1]
|
| 143 |
+
delete_url = f"{PHP_PROXY_URL}{delete_method_name}"
|
| 144 |
+
set_url = f"{PHP_PROXY_URL}{set_method_name}"
|
| 145 |
|
| 146 |
try:
|
| 147 |
delete_response = make_telegram_request('deleteMyCommands')
|
|
|
|
| 451 |
async def sendTelegramMessage(chatId, text, options={}):
|
| 452 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
| 453 |
if PHP_PROXY_URL:
|
| 454 |
+
method_name = url.split('/')[-1]
|
| 455 |
+
url = f"{PHP_PROXY_URL}{method_name}"
|
| 456 |
data = {
|
| 457 |
'chat_id': chatId,
|
| 458 |
'text': text,
|