From 368dcd0d31d476dfe2fd5c8eef540aafc7171339 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 26 Sep 2024 16:11:14 +0300 Subject: [PATCH] toxic-score-reply --- handlers/messages_routing.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index ce7b4cd..7de9a37 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -33,19 +33,13 @@ async def messages_routing(msg, state): elif bool(text): mid = msg.get("message_id") - if text == '/score@welcomecenter_bot': + if reply_msg and text == '/score@welcomecenter_bot': + rmsg = reply_msg.get("message_id") await telegram_api( "sendMessage", chat_id=cid, - reply_to_message_id=mid, - text=f"{latest_toxic.get(cid, 0)}% токсичности" - ) - elif text == '/score' and reply_to: - await telegram_api( - "re", - chat_id=cid, - reply_to_message_id=mid, - text=f"{latest_toxic.get(f"{cid}:{reply_msg.get("message_id")}", 0)}% токсичности" + reply_to_message_id=rmsg, + text=f"{latest_toxic.get(f"{cid}:{rmsg}", 0)}% токсичности" ) else: toxic_score = detector(text)