test escape
This commit is contained in:
parent
831cacbf37
commit
0cfdce0d4a
18
app/main.py
18
app/main.py
|
@ -55,13 +55,23 @@ async def tg_intgr_get(request: Request):
|
|||
)
|
||||
data = requests.get(get_comment_hook)
|
||||
data_json = data.json()
|
||||
comment = ' '.join(re.sub(r"((\[)(.*?)(]))", "", data_json["result"]["POST_MESSAGE"]).split(' ')[:100])
|
||||
comment = f"\nhttps://crm.svs-tech.pro/company/personal/user/{bx_id}/tasks/task/view/{task_id}/"
|
||||
comment += " ".join(
|
||||
re.sub(
|
||||
r"((\[)(.*?)(]))",
|
||||
"",
|
||||
re.escape(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"])
|
||||
mentions = re.findall(
|
||||
rf"\[USER=({bx_id})\]", data_json["result"]["POST_MESSAGE"]
|
||||
)
|
||||
for _ in mentions:
|
||||
logger.info("https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={tg_id}&text={comment}")
|
||||
logger.info(
|
||||
"https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={tg_id}&text={comment}"
|
||||
)
|
||||
requests.get(
|
||||
f"https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={tg_id}&text={comment}"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue