From 9412ec1458f9d01a7454bfcf0cc34f6f464391dd Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 26 Sep 2024 17:43:44 +0300 Subject: [PATCH] less-log3 --- handlers/messages_routing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index 4a2ab12..eb82b99 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -41,8 +41,8 @@ async def messages_routing(msg, state): async for key in client.scan_iter(pattern): scr = int(await redis.get(key)) scores.append(scr) - toxic_score = math.floor(sum(scores)/len(scores)) - text = f"Средняя токсичность сообщений: {toxic_score}%" + toxic_score = math.floor(sum(scores)/len(scores)) if scores else 0 + text = f"Средняя токсичность сообщений: {toxic_score}% else: latest_toxic_message_id = await redis.get(f"toxic:{cid}") scoring_msg_id = reply_msg.get("message_id") or latest_toxic_message_id