stability-patch
This commit is contained in:
parent
6d4df35f52
commit
d156c10855
|
@ -49,10 +49,12 @@ async def messages_routing(msg, state):
|
||||||
reply_to_msg_id = reply_msg.get("message_id")
|
reply_to_msg_id = reply_msg.get("message_id")
|
||||||
if not reply_to_msg_id and latest_toxic_message_id:
|
if not reply_to_msg_id and latest_toxic_message_id:
|
||||||
reply_to_msg_id = int(latest_toxic_message_id)
|
reply_to_msg_id = int(latest_toxic_message_id)
|
||||||
|
try:
|
||||||
# count average between all of messages
|
# count average between all of messages
|
||||||
toxic_pattern = f"toxic:{cid}:{uid}:*"
|
toxic_pattern = f"toxic:{cid}:{uid}:*"
|
||||||
toxic_score = await get_average_pattern(toxic_pattern)
|
toxic_score = await get_average_pattern(toxic_pattern)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# current mesasage toxicity
|
# current mesasage toxicity
|
||||||
if reply_to_msg_id:
|
if reply_to_msg_id:
|
||||||
|
@ -70,7 +72,9 @@ async def messages_routing(msg, state):
|
||||||
if toxic_score > 20
|
if toxic_score > 20
|
||||||
else "😇"
|
else "😇"
|
||||||
)
|
)
|
||||||
text = f"{int(one_score)}% токсичности\nСредняя токсичность сообщений: {toxic_score}% {emoji}"
|
text = f"{int(one_score)}% токсичности\n"
|
||||||
|
if toxic_score:
|
||||||
|
text += "Средняя токсичность сообщений: {toxic_score}% {emoji}"
|
||||||
await telegram_api(
|
await telegram_api(
|
||||||
"sendMessage",
|
"sendMessage",
|
||||||
chat_id=cid,
|
chat_id=cid,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user