位置显示支持

This commit is contained in:
xaoyaoo 2024-06-21 17:26:26 +08:00
parent 2fe136b0f3
commit a73f8f2d6a

View File

@ -5,6 +5,7 @@
# Author: xaoyaoo
# Date: 2024/04/15
# -------------------------------------------------------------------------------
import json
import os
import re
@ -18,6 +19,7 @@ import blackboxprotobuf
class ParsingMSG(DatabaseBase):
_class_name = "MSG"
def __init__(self, db_path):
super().__init__(db_path)
@ -172,7 +174,13 @@ class ParsingMSG(DatabaseBase):
cdnurl = content_tmp.get("emoji", {}).get("cdnurl", "")
if cdnurl:
content = {"src": cdnurl, "msg": "表情"}
elif type_id == (48, 0): # 地图信息
content_tmp = xml2dict(StrContent)
location = content_tmp.get("location", {})
content["msg"] = (f"纬度:【{location.pop('x')}】 经度:【{location.pop('y')}\n"
f"位置:{location.pop('label')} {location.pop('poiname')}\n"
f"其他信息:{json.dumps(location, ensure_ascii=False, indent=4)}"
)
elif type_id == (49, 0):
DictExtra = self.get_BytesExtra(BytesExtra)
url = match_BytesExtra(DictExtra)