From 10b77d877c9e5c6a05d0e6ac602628072d08e8b4 Mon Sep 17 00:00:00 2001 From: This is XiaoDeng <1744793737@qq.com> Date: Sat, 11 Nov 2023 11:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=20location=20=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=AE=B5=20(V12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message_parser.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/message_parser.py b/message_parser.py index 607d314..cc9b0d1 100644 --- a/message_parser.py +++ b/message_parser.py @@ -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"])