float-none-fix

This commit is contained in:
Untone 2024-09-26 17:38:00 +03:00
parent 9537d8875b
commit 2eeb112c14

View File

@ -32,6 +32,8 @@ async def messages_routing(msg, state):
elif bool(text):
mid = msg.get("message_id")
if text == '/toxic@welcomecenter_bot':
text = ''
toxic_score = 0
if not reply_msg:
scoring_msg_id = mid
pattern = f"toxic:{cid}:{uid}:*"
@ -44,8 +46,10 @@ async def messages_routing(msg, state):
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 = float(await redis.get(f"toxic:{cid}:{uid}:{scoring_msg_id}"))
text = f"{float(toxic_score)}% токсичности"
toxic_score = await redis.get(f"toxic:{cid}:{uid}:{scoring_msg_id}")
if toxic_score:
text = f"{toxic_score}% токсичности"
if text:
await telegram_api(
"sendMessage",
chat_id=cid,