toxic-score-reply-fix2

This commit is contained in:
Untone 2024-09-26 16:14:14 +03:00
parent 6129d2fab8
commit 6d1372fd7f

View File

@ -33,8 +33,8 @@ async def messages_routing(msg, state):
elif bool(text):
mid = msg.get("message_id")
if reply_msg and text == '/score@welcomecenter_bot':
rmsg = reply_msg.get("message_id")
if text == '/score@welcomecenter_bot':
rmsg = reply_msg.get("message_id", latest_toxic[cid])
await telegram_api(
"sendMessage",
chat_id=cid,
@ -49,7 +49,7 @@ async def messages_routing(msg, state):
else:
toxic_score = detector(text)
toxic_perc = math.floor(toxic_score*100)
latest_toxic[cid] = toxic_perc
latest_toxic[cid] = mid
latest_toxic[f"{cid}:{mid}"] = toxic_perc
logger.info(f'\ntext: {text}\ntoxic: {toxic_perc}%')
if toxic_score > 0.81: