From b87501e99f3b168f9d52cb57581ea25c807617e8 Mon Sep 17 00:00:00 2001 From: randogoth Date: Mon, 22 May 2023 01:16:04 +0300 Subject: [PATCH] added bot --- userdb/db.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/userdb/db.py b/userdb/db.py index b17f9da..2c3504b 100644 --- a/userdb/db.py +++ b/userdb/db.py @@ -1,9 +1,18 @@ import json import os +import requests from flask import Flask, request from waitress import serve from functools import reduce +TOKEN = '5828518687:AAFxnEivg-SVL0OzAs2NrLiISKksjMLZq6M' +CHAT_ID = '26113616' + +def send_msg(text): + url_req = "https://api.telegram.org/bot" + TOKEN + "/sendMessage" + "?chat_id=" + CHAT_ID + "&text=" + text + "&parse_mode=markdown&disable_web_page_preview=true" + return requests.get(url_req) + + app = Flask(__name__) @app.route("/track", methods = ['GET']) @@ -30,6 +39,9 @@ def track(): 'agent' : ua } }) + + send_msg(f'User <{hash}> visited { url } on { ua }') + with open('db.json', 'w+') as dbw: dbw.write(json.dumps(db, indent=4))