Merge pull request #1368 from unknownsno/main

fix bug
This commit is contained in:
HibiKier 2023-04-16 03:07:41 +08:00 committed by GitHub
commit 0be8533063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,10 @@ def image(
if file.startswith(("http", "base64://")):
return MessageSegment.image(file)
else:
return MessageSegment.image(IMAGE_PATH / file)
if (IMAGE_PATH / file).exists():
return MessageSegment.image(IMAGE_PATH / file)
logger.warning(f"图片 {(IMAGE_PATH / file).absolute()}缺失...")
return ""
if isinstance(file, Path):
if file.exists():
return MessageSegment.image(file)