float-none-fix
This commit is contained in:
parent
9537d8875b
commit
2eeb112c14
|
@ -32,6 +32,8 @@ 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':
|
if text == '/toxic@welcomecenter_bot':
|
||||||
|
text = ''
|
||||||
|
toxic_score = 0
|
||||||
if not reply_msg:
|
if not reply_msg:
|
||||||
scoring_msg_id = mid
|
scoring_msg_id = mid
|
||||||
pattern = f"toxic:{cid}:{uid}:*"
|
pattern = f"toxic:{cid}:{uid}:*"
|
||||||
|
@ -44,14 +46,16 @@ async def messages_routing(msg, state):
|
||||||
else:
|
else:
|
||||||
latest_toxic_message_id = await redis.get(f"toxic:{cid}")
|
latest_toxic_message_id = await redis.get(f"toxic:{cid}")
|
||||||
scoring_msg_id = 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 = float(await redis.get(f"toxic:{cid}:{uid}:{scoring_msg_id}"))
|
toxic_score = await redis.get(f"toxic:{cid}:{uid}:{scoring_msg_id}")
|
||||||
text = f"{float(toxic_score)}% токсичности"
|
if toxic_score:
|
||||||
await telegram_api(
|
text = f"{toxic_score}% токсичности"
|
||||||
"sendMessage",
|
if text:
|
||||||
chat_id=cid,
|
await telegram_api(
|
||||||
reply_to_message_id=scoring_msg_id,
|
"sendMessage",
|
||||||
text=text
|
chat_id=cid,
|
||||||
)
|
reply_to_message_id=scoring_msg_id,
|
||||||
|
text=text
|
||||||
|
)
|
||||||
await telegram_api(
|
await telegram_api(
|
||||||
"deleteMessage",
|
"deleteMessage",
|
||||||
chat_id=cid,
|
chat_id=cid,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user