Rename the obj variable to json_obj in telegram_json_format

This commit is contained in:
KnugiHK
2026-01-17 13:54:56 +08:00
parent 2d096eff4d
commit a6fe0d93b1

View File

@@ -674,7 +674,7 @@ def telegram_json_format(jik: str, data: Dict, timezone_offset) -> Dict:
except ValueError:
# not a real chat: e.g. statusbroadcast
chat_id = 0
obj = {
json_obj = {
"name": data["name"] if data["name"] else jik,
"type": get_chat_type(jik),
"id": chat_id,
@@ -694,14 +694,15 @@ def telegram_json_format(jik: str, data: Dict, timezone_offset) -> Dict:
"text": msg["data"],
}
],
} for msgId, msg in data["messages"].items()]
}
for msgId, msg in data["messages"].items()]
}
# remove empty messages and replies
for msg_id, msg in enumerate(obj["messages"]):
for msg_id, msg in enumerate(json_obj["messages"]):
if not msg["reply_to_message_id"]:
del obj["messages"][msg_id]["reply_to_message_id"]
obj["messages"] = [m for m in obj["messages"] if m["text"]]
return obj
del json_obj["messages"][msg_id]["reply_to_message_id"]
json_obj["messages"] = [m for m in json_obj["messages"] if m["text"]]
return json_obj
class WhatsAppIdentifier(StrEnum):