From c9185ff3f7d4dab4f67aa7b57abe9a7be6dfbe10 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Thu, 20 May 2021 20:37:26 +0800 Subject: [PATCH] Update __init__.py --- plugins/send_img/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/send_img/__init__.py b/plugins/send_img/__init__.py index 232e5998..204ba4db 100644 --- a/plugins/send_img/__init__.py +++ b/plugins/send_img/__init__.py @@ -35,6 +35,9 @@ async def _(bot: Bot, event: Event, state: T_State): logger.warning(f'未找到 {path} 文件夹,调用取消!') return length = len(os.listdir(IMAGE_PATH + path)) - 1 + if length == 0: + logger.warning(f'图库 {path} 为空,调用取消!') + return index = img_id if img_id else str(random.randint(0, length)) if not is_number(index): await send_img.finish("id错误!")