Update __init__.py

This commit is contained in:
HibiKier 2021-05-20 20:37:26 +08:00 committed by GitHub
parent e911155437
commit c9185ff3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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错误")