Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,6 @@ from api_logic import api
|
|
12 |
import requests
|
13 |
|
14 |
|
15 |
-
from pyngrok import ngrok
|
16 |
|
17 |
load_dotenv()
|
18 |
|
@@ -102,20 +101,12 @@ app.config['DEBUG'] = True
|
|
102 |
TELEGRAM_BOT_TOKEN = "7766407698:AAGZHEbUuiOri4_YzZ7hDPSD6U8MGMXXSnA"
|
103 |
|
104 |
|
105 |
-
# Запускаем ngrok для порта 7860
|
106 |
-
public_url = ngrok.connect(7860).public_url
|
107 |
-
print(f"Webhook URL: {public_url}")
|
108 |
-
|
109 |
-
# Устанавливаем вебхук
|
110 |
-
webhook_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/setWebhook"
|
111 |
-
requests.post(webhook_url, data={"url": public_url})
|
112 |
-
|
113 |
def send_message(chat_id, text):
|
114 |
"""Отправка текстового сообщения в Telegram."""
|
115 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
116 |
data = {"chat_id": chat_id, "text": text}
|
117 |
response = requests.post(url, data=data)
|
118 |
-
print(f"Ответ Telegram: {response.json()}") # Лог
|
119 |
|
120 |
@app.route("/", methods=["POST"])
|
121 |
def process():
|
|
|
12 |
import requests
|
13 |
|
14 |
|
|
|
15 |
|
16 |
load_dotenv()
|
17 |
|
|
|
101 |
TELEGRAM_BOT_TOKEN = "7766407698:AAGZHEbUuiOri4_YzZ7hDPSD6U8MGMXXSnA"
|
102 |
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
def send_message(chat_id, text):
|
105 |
"""Отправка текстового сообщения в Telegram."""
|
106 |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
107 |
data = {"chat_id": chat_id, "text": text}
|
108 |
response = requests.post(url, data=data)
|
109 |
+
print(f"Ответ Telegram: {response.json()}") # Лог для проверки
|
110 |
|
111 |
@app.route("/", methods=["POST"])
|
112 |
def process():
|