test remove all square brackets text and split 100 words

This commit is contained in:
Kseninia Mikhaylova 2024-06-03 13:21:29 +03:00
parent 4d56da588e
commit 80eafafb51
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ async def tg_intgr_get(request: Request):
) )
data = requests.get(get_comment_hook) data = requests.get(get_comment_hook)
data_json = data.json() 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}/' 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"]) mentions = re.findall(rf"\[USER=({bx_id})\]", data_json["result"]["POST_MESSAGE"])