diff --git a/app/main.py b/app/main.py index d54d35f..3db1246 100644 --- a/app/main.py +++ b/app/main.py @@ -7,6 +7,10 @@ from app.constants import * app = FastAPI() +tg = { + 38: '@aarizona' +} +TOKEN = "7102273461:AAGi8RXCEvns2ONu3RcG9Up973vcLzTdCJg" @app.get("/") def read_root(): @@ -52,8 +56,10 @@ async def tg_intgr_get(request: Request): data_json = data.json() comment = data_json["result"]["POST_MESSAGE"] - mention = re.findall(r"\[USER=(\d*)\]", comment) - logger.info(mention) + mentions = re.findall(r"\[USER=(\d*)\]", comment) + for mention in mentions: + if tg[int(mention)]: + requests.get(f'https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={tg[int(mention)]}&text={comment}') return {"status": "success"} except: