diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index 8287c58..549bea2 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -42,11 +42,11 @@ async def messages_routing(msg, state): msg_toxic_key = f"toxic:{cid}:{uid}:{scoring_msg_id}" logger.debug('msg_toxic_key: ', msg_toxic_key) one_score = await redis.get(msg_toxic_key) - msg_score = int(one_score[0]) - logger.debug('one_score: ', msg_score) - emoji = '😳' if toxic_score > 90 else '😟' if toxic_score > 80 else '😏' if toxic_score > 60 else '🙂' if toxic_score > 20 else '😇' - text = f"{msg_score}% токсичности\nСредняя токсичность сообщений: {toxic_score}% {emoji}" - if text: + if one_score: + msg_score = int(one_score[0]) + logger.debug('one_score: ', msg_score) + emoji = '😳' if toxic_score > 90 else '😟' if toxic_score > 80 else '😏' if toxic_score > 60 else '🙂' if toxic_score > 20 else '😇' + text = f"{msg_score}% токсичности\nСредняя токсичность сообщений: {toxic_score}% {emoji}" await telegram_api( "sendMessage", chat_id=cid,