score_msg_id

This commit is contained in:
2024-09-26 16:43:10 +03:00
parent 960260ee9f
commit 6bffb8039b

View File

@@ -31,15 +31,15 @@ async def messages_routing(msg, state):
elif bool(text): elif bool(text):
mid = msg.get("message_id") mid = msg.get("message_id")
if text == '/toxic@welcomecenter_bot':
latest_toxic_message_id = await redis.get(f"toxic:{cid}") latest_toxic_message_id = await redis.get(f"toxic:{cid}")
if latest_toxic_message_id: if text == '/toxic@welcomecenter_bot' and latest_toxic_message_id:
rmsg = reply_msg.get("message_id") or latest_toxic_message_id scoring_msg_id = reply_msg.get("message_id") or latest_toxic_message_id
toxic_score = await redis.get(f"toxic:{cid}:{scoring_msg_id}")
await telegram_api( await telegram_api(
"sendMessage", "sendMessage",
chat_id=cid, chat_id=cid,
reply_to_message_id=rmsg, reply_to_message_id=scoring_msg_id,
text=f"{latest_toxic.get(f"{cid}:{rmsg}", 0)}% токсичности" text=f"{toxic_score}% токсичности"
) )
await telegram_api( await telegram_api(
"deleteMessage", "deleteMessage",