From f627498bcacb16bbf66f8ae84e8758e8915d088e Mon Sep 17 00:00:00 2001 From: wangxyd <174403987+solidabamboo@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:17:23 +0800 Subject: [PATCH] suppoert s.coze.cn --- nicecoze.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nicecoze.py b/nicecoze.py index 580363a..7b4bf66 100644 --- a/nicecoze.py +++ b/nicecoze.py @@ -39,7 +39,7 @@ class NiceCoze(Plugin): return # 提取Coze返回的Markdown图片链接中的网址,并修改ReplyType为IMAGE_URL,以便CoW自动下载Markdown链接中的图片 #if all(x in content for x in ['![', 'http']) and any(x in content for x in ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp']): - if 'http' in content and any(x in content for x in ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp']): + if 'http' in content and any(x in content for x in ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp']): logger.debug(f"[Nicecoze] starting decorate_markdown_image, content={content}") replies = self.decorate_markdown_image(content) if replies: @@ -60,7 +60,7 @@ class NiceCoze(Plugin): logger.info(f"[Nicecoze] match_obj_s_coze_cn found, link_url={link_url}") response = requests.get(url=link_url, allow_redirects=False) original_url = response.headers.get('Location') - if response.status_code in [301, 302] and original_url and any(x in original_url for x in ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp']): + if response.status_code in [301, 302] and original_url and any(x in original_url for x in ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp']): logger.info(f"[Nicecoze] match_obj_s_coze_cn found and original_url is a image url, original_url={original_url}") reply = Reply(ReplyType.IMAGE_URL, original_url) e_context["reply"] = reply