diff --git a/src/recv_handler/__init__.py b/src/recv_handler/__init__.py index 3f342fd..c6accec 100644 --- a/src/recv_handler/__init__.py +++ b/src/recv_handler/__init__.py @@ -84,4 +84,17 @@ class CommandType(Enum): return self.value -ACCEPT_FORMAT = ["text", "image", "emoji", "reply", "voice", "command", "voiceurl", "music", "videourl", "file", "forward"] +ACCEPT_FORMAT = [ + "text", + "image", + "emoji", + "reply", + "voice", + "command", + "voiceurl", + "music", + "videourl", + "file", + "imageurl", + "forward", +] diff --git a/src/send_handler/send_message_handler.py b/src/send_handler/send_message_handler.py index 308b688..db80c29 100644 --- a/src/send_handler/send_message_handler.py +++ b/src/send_handler/send_message_handler.py @@ -62,6 +62,9 @@ class SendMessageHandleClass: elif seg.type == "file": file_path = seg.data new_payload = cls.build_payload(payload, cls.handle_file_message(file_path), False) + elif seg.type == "imageurl": + image_url = seg.data + new_payload = cls.build_payload(payload, cls.handle_imageurl_message(image_url), False) elif seg.type == "forward" and not in_forward: forward_message_content: List[Dict] = seg.data new_payload: List[Dict] = [ @@ -186,3 +189,11 @@ class SendMessageHandleClass: "type": "file", "data": {"file": f"file://{file_path}"}, } + + @staticmethod + def handle_imageurl_message(image_url: str) -> dict: + """处理图片链接消息""" + return { + "type": "image", + "data": {"file": image_url}, + }