less-log3

This commit is contained in:
2024-09-26 17:43:44 +03:00
parent c9975f7b7f
commit 9412ec1458

View File

@@ -41,8 +41,8 @@ async def messages_routing(msg, state):
async for key in client.scan_iter(pattern): async for key in client.scan_iter(pattern):
scr = int(await redis.get(key)) scr = int(await redis.get(key))
scores.append(scr) scores.append(scr)
toxic_score = math.floor(sum(scores)/len(scores)) toxic_score = math.floor(sum(scores)/len(scores)) if scores else 0
text = f"Средняя токсичность сообщений: {toxic_score}%" text = f"Средняя токсичность сообщений: {toxic_score}%
else: else:
latest_toxic_message_id = await redis.get(f"toxic:{cid}") latest_toxic_message_id = await redis.get(f"toxic:{cid}")
scoring_msg_id = reply_msg.get("message_id") or latest_toxic_message_id scoring_msg_id = reply_msg.get("message_id") or latest_toxic_message_id