diff --git a/src/recv_handler/__init__.py b/src/recv_handler/__init__.py index 422041b..9b48285 100644 --- a/src/recv_handler/__init__.py +++ b/src/recv_handler/__init__.py @@ -84,4 +84,4 @@ class CommandType(Enum): return self.value -ACCEPT_FORMAT = ["text", "image", "emoji", "reply", "voice", "command", "voiceurl", "music", "videourl", "file"] +ACCEPT_FORMAT = ["text", "image", "emoji", "reply", "voice", "command", "voiceurl", "music", "videourl", "file","imageurl"] diff --git a/src/send_handler.py b/src/send_handler.py index cf64a44..4687993 100644 --- a/src/send_handler.py +++ b/src/send_handler.py @@ -181,6 +181,9 @@ class SendHandler: elif seg.type == "file": file_path = seg.data new_payload = self.build_payload(payload, self.handle_file_message(file_path), False) + elif seg.type == "imageurl": + image_url = seg.data + new_payload = self.build_payload(payload, self.handle_imageurl_message(image_url), False) return new_payload def build_payload(self, payload: list, addon: dict, is_reply: bool = False) -> list: @@ -270,6 +273,13 @@ class SendHandler: "type": "file", "data": {"file": f"file://{file_path}"}, } + + def handle_imageurl_message(self, image_url: str) -> dict: + """处理图片链接消息""" + return { + "type": "image", + "data": {"file": image_url}, + } def handle_ban_command(self, args: Dict[str, Any], group_info: GroupInfo) -> Tuple[str, Dict[str, Any]]: """处理封禁命令