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)