fix-fmt
This commit is contained in:
parent
0604a4fd8f
commit
9537d8875b
|
@ -37,18 +37,20 @@ async def messages_routing(msg, state):
|
|||
pattern = f"toxic:{cid}:{uid}:*"
|
||||
scores = []
|
||||
async for key in client.scan_iter(pattern):
|
||||
scr = await redis.get(key)
|
||||
scr = int(await redis.get(key))
|
||||
scores.append(scr)
|
||||
toxic_score = sum(scores)/len(scores)
|
||||
toxic_score = math.floor(sum(scores)/len(scores))
|
||||
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
|
||||
toxic_score = await redis.get(f"toxic:{cid}:{uid}:{scoring_msg_id}")
|
||||
toxic_score = float(await redis.get(f"toxic:{cid}:{uid}:{scoring_msg_id}"))
|
||||
text = f"{float(toxic_score)}% токсичности"
|
||||
await telegram_api(
|
||||
"sendMessage",
|
||||
chat_id=cid,
|
||||
reply_to_message_id=scoring_msg_id,
|
||||
text=f"{toxic_score}% токсичности"
|
||||
text=text
|
||||
)
|
||||
await telegram_api(
|
||||
"deleteMessage",
|
||||
|
|
Loading…
Reference in New Issue
Block a user