From 80eafafb5118a8b1a6700e0b60f5bc6b15f1fdc3 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Mon, 3 Jun 2024 13:21:29 +0300 Subject: [PATCH] test remove all square brackets text and split 100 words --- app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index bd64db4..c10cf7e 100644 --- a/app/main.py +++ b/app/main.py @@ -55,7 +55,8 @@ async def tg_intgr_get(request: Request): ) data = requests.get(get_comment_hook) data_json = data.json() - comment = re.sub(r"\[USER=\d+\]|\[\/USER\]", "", data_json["result"]["POST_MESSAGE"]) + comment = re.sub(r"((\[)(.*?)(]))", "", data_json["result"]["POST_MESSAGE"]).split(' ')[:100] + comment += f'\nот {data_json["result"]["AUTHOR_NAME"]}' comment += f'\nhttps://crm.svs-tech.pro/company/personal/user/{bx_id}/tasks/task/view/{task_id}/' mentions = re.findall(rf"\[USER=({bx_id})\]", data_json["result"]["POST_MESSAGE"])