Merge pull request #2181 from 6vision/webp_images

Support images in webp format.
This commit is contained in:
vision
2024-08-02 13:47:39 +08:00
committed by GitHub
4 changed files with 33 additions and 4 deletions

View File

@@ -55,7 +55,7 @@ class Keyword(Plugin):
reply_text = self.keyword[content]
# 判断匹配内容的类型
if (reply_text.startswith("http://") or reply_text.startswith("https://")) and any(reply_text.endswith(ext) for ext in [".jpg", ".jpeg", ".png", ".gif", ".img"]):
if (reply_text.startswith("http://") or reply_text.startswith("https://")) and any(reply_text.endswith(ext) for ext in [".jpg", ".webp", ".jpeg", ".png", ".gif", ".img"]):
# 如果是以 http:// 或 https:// 开头,且".jpg", ".jpeg", ".png", ".gif", ".img"结尾,则认为是图片 URL。
reply = Reply()
reply.type = ReplyType.IMAGE_URL