no-process-score2
This commit is contained in:
parent
5658992a88
commit
f51548dc07
|
@ -33,34 +33,34 @@ async def messages_routing(msg, state):
|
|||
|
||||
elif bool(text):
|
||||
mid = msg.get("message_id")
|
||||
if text.startswith('/score'):
|
||||
if text == '/score@welcomecenter_bot':
|
||||
await telegram_api(
|
||||
"sendMessage",
|
||||
chat_id=cid,
|
||||
reply_to=mid,
|
||||
text=f"{latest_toxic.get(cid, 0)}%"
|
||||
)
|
||||
return
|
||||
toxic_score = detector(text)
|
||||
toxic_perc = math.floor(toxic_score*100)
|
||||
latest_toxic[cid] = toxic_perc
|
||||
logger.info(f'\ntext: {text}\ntoxic: {toxic_perc}%')
|
||||
if toxic_score > 0.81:
|
||||
if toxic_score > 0.90:
|
||||
await redis.set(f"removed:{uid}:{cid}:{mid}", text)
|
||||
await telegram_api(
|
||||
"deleteMessage",
|
||||
chat_id=cid,
|
||||
message_id=mid
|
||||
)
|
||||
else:
|
||||
await telegram_api(
|
||||
"setMessageReaction",
|
||||
chat_id=cid,
|
||||
is_big=True,
|
||||
message_id=mid,
|
||||
reaction=f'[{{"type":"emoji", "emoji":"🙉"}}]'
|
||||
)
|
||||
else:
|
||||
toxic_score = detector(text)
|
||||
toxic_perc = math.floor(toxic_score*100)
|
||||
latest_toxic[cid] = toxic_perc
|
||||
logger.info(f'\ntext: {text}\ntoxic: {toxic_perc}%')
|
||||
if toxic_score > 0.81:
|
||||
if toxic_score > 0.90:
|
||||
await redis.set(f"removed:{uid}:{cid}:{mid}", text)
|
||||
await telegram_api(
|
||||
"deleteMessage",
|
||||
chat_id=cid,
|
||||
message_id=mid
|
||||
)
|
||||
else:
|
||||
await telegram_api(
|
||||
"setMessageReaction",
|
||||
chat_id=cid,
|
||||
is_big=True,
|
||||
message_id=mid,
|
||||
reaction=f'[{{"type":"emoji", "emoji":"🙉"}}]'
|
||||
)
|
||||
|
||||
else:
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue
Block a user