Skip to content

Commit

Permalink
支持 location 消息段 (V12)
Browse files Browse the repository at this point in the history
  • Loading branch information
This-is-XiaoDeng committed Nov 11, 2023
1 parent f178327 commit 10b77d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions message_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ async def parse_message(message: list) -> dict:
message_data = {"content": "", "files": []}
for segment in message:
try:
match segment["type"]:
case "location":
segment = {
"type": "discord.embed",
"data": {
"title": segment["data"]["title"],
"description": segment["data"]["content"],
"url": f"https://www.google.com/maps/place/{segment['data']['latitude']},{segment['data']['longitude']}"
}
}
match segment["type"]:
case "text":
message_data["content"] += escape_mentions(segment["data"]["text"])
Expand Down

0 comments on commit 10b77d8

Please sign in to comment.