toxic-score-reply-fix2
This commit is contained in:
parent
6129d2fab8
commit
6d1372fd7f
|
@ -33,8 +33,8 @@ async def messages_routing(msg, state):
|
||||||
|
|
||||||
elif bool(text):
|
elif bool(text):
|
||||||
mid = msg.get("message_id")
|
mid = msg.get("message_id")
|
||||||
if reply_msg and text == '/score@welcomecenter_bot':
|
if text == '/score@welcomecenter_bot':
|
||||||
rmsg = reply_msg.get("message_id")
|
rmsg = reply_msg.get("message_id", latest_toxic[cid])
|
||||||
await telegram_api(
|
await telegram_api(
|
||||||
"sendMessage",
|
"sendMessage",
|
||||||
chat_id=cid,
|
chat_id=cid,
|
||||||
|
@ -49,7 +49,7 @@ async def messages_routing(msg, state):
|
||||||
else:
|
else:
|
||||||
toxic_score = detector(text)
|
toxic_score = detector(text)
|
||||||
toxic_perc = math.floor(toxic_score*100)
|
toxic_perc = math.floor(toxic_score*100)
|
||||||
latest_toxic[cid] = toxic_perc
|
latest_toxic[cid] = mid
|
||||||
latest_toxic[f"{cid}:{mid}"] = toxic_perc
|
latest_toxic[f"{cid}:{mid}"] = toxic_perc
|
||||||
logger.info(f'\ntext: {text}\ntoxic: {toxic_perc}%')
|
logger.info(f'\ntext: {text}\ntoxic: {toxic_perc}%')
|
||||||
if toxic_score > 0.81:
|
if toxic_score > 0.81:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user