|
@@ -46,35 +46,6 @@ class FeishuMessage(ChatMessage): |
|
|
else: |
|
|
else: |
|
|
logger.info(f"[FeiShu] Failed to download file, key={file_key}, res={response.text}") |
|
|
logger.info(f"[FeiShu] Failed to download file, key={file_key}, res={response.text}") |
|
|
self._prepare_fn = _download_file |
|
|
self._prepare_fn = _download_file |
|
|
|
|
|
|
|
|
# elif msg.type == "voice": |
|
|
|
|
|
# self.ctype = ContextType.VOICE |
|
|
|
|
|
# self.content = TmpDir().path() + msg.media_id + "." + msg.format # content直接存临时目录路径 |
|
|
|
|
|
# |
|
|
|
|
|
# def download_voice(): |
|
|
|
|
|
# # 如果响应状态码是200,则将响应内容写入本地文件 |
|
|
|
|
|
# response = client.media.download(msg.media_id) |
|
|
|
|
|
# if response.status_code == 200: |
|
|
|
|
|
# with open(self.content, "wb") as f: |
|
|
|
|
|
# f.write(response.content) |
|
|
|
|
|
# else: |
|
|
|
|
|
# logger.info(f"[wechatcom] Failed to download voice file, {response.content}") |
|
|
|
|
|
# |
|
|
|
|
|
# self._prepare_fn = download_voice |
|
|
|
|
|
# elif msg.type == "image": |
|
|
|
|
|
# self.ctype = ContextType.IMAGE |
|
|
|
|
|
# self.content = TmpDir().path() + msg.media_id + ".png" # content直接存临时目录路径 |
|
|
|
|
|
# |
|
|
|
|
|
# def download_image(): |
|
|
|
|
|
# # 如果响应状态码是200,则将响应内容写入本地文件 |
|
|
|
|
|
# response = client.media.download(msg.media_id) |
|
|
|
|
|
# if response.status_code == 200: |
|
|
|
|
|
# with open(self.content, "wb") as f: |
|
|
|
|
|
# f.write(response.content) |
|
|
|
|
|
# else: |
|
|
|
|
|
# logger.info(f"[wechatcom] Failed to download image file, {response.content}") |
|
|
|
|
|
# |
|
|
|
|
|
# self._prepare_fn = download_image |
|
|
|
|
|
else: |
|
|
else: |
|
|
raise NotImplementedError("Unsupported message type: Type:{} ".format(msg_type)) |
|
|
raise NotImplementedError("Unsupported message type: Type:{} ".format(msg_type)) |
|
|
|
|
|
|
|
|