diff --git a/API/TG.py b/API/TG.py new file mode 100644 index 0000000..36422a9 --- /dev/null +++ b/API/TG.py @@ -0,0 +1,18 @@ +import requests + +BOT_TOKEN = "8785472748:AAE16NRClF_3fe8HfJcsPVPBPPSq2CD_3Pw" # токен бота +CHAT_ID = "-1001889935010" # id чата + +def send_telegram(text): + url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage" + + response = requests.post(url, json={ + "chat_id": CHAT_ID, + "text": text + }) + + return response.json() + + + +send_telegram("TEST") \ No newline at end of file diff --git a/app/__pycache__/routes.cpython-313.pyc b/app/__pycache__/routes.cpython-313.pyc index cd86576..37a1e5d 100644 Binary files a/app/__pycache__/routes.cpython-313.pyc and b/app/__pycache__/routes.cpython-313.pyc differ diff --git a/app/routes.py b/app/routes.py index 760cc7a..ed18ca8 100644 --- a/app/routes.py +++ b/app/routes.py @@ -3,6 +3,7 @@ import sqlite3 import json # from services.rokky import ones # from API.rok import get_order_content +from API.TG import send_telegram import logging @@ -29,7 +30,7 @@ def index1(): # всё остальное сохраняем как JSON content = json.dumps(params, ensure_ascii=False) - + send_telegram(content) conn = sqlite3.connect(DB_PATH) cursor = conn.cursor()