diff options
author | Kyomotoi <[email protected]> | 2022-06-09 22:32:12 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2022-06-09 22:32:12 +0800 |
commit | 88a4105e7cbfbcd7952b3d47be3279f021f7ad6f (patch) | |
tree | 4ea6c61f0c058ae6eef57678ed3717d7d4ffe6bf /ATRI/plugins/essential.py | |
parent | a8163fc8b97612793d3b55ebd4e90c61cd4ba77a (diff) | |
download | ATRI-88a4105e7cbfbcd7952b3d47be3279f021f7ad6f.tar.gz ATRI-88a4105e7cbfbcd7952b3d47be3279f021f7ad6f.tar.bz2 ATRI-88a4105e7cbfbcd7952b3d47be3279f021f7ad6f.zip |
💩 优化代码
Diffstat (limited to 'ATRI/plugins/essential.py')
-rw-r--r-- | ATRI/plugins/essential.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ATRI/plugins/essential.py b/ATRI/plugins/essential.py index 37c18a4..763b137 100644 --- a/ATRI/plugins/essential.py +++ b/ATRI/plugins/essential.py @@ -1,4 +1,3 @@ -import os import json import shutil import asyncio @@ -44,9 +43,9 @@ bots = nonebot.get_bots() ESSENTIAL_DIR = Path(".") / "data" / "database" / "essential" MANEGE_DIR = Path(".") / "data" / "database" / "manege" TEMP_PATH = Path(".") / "data" / "temp" -os.makedirs(ESSENTIAL_DIR, exist_ok=True) -os.makedirs(MANEGE_DIR, exist_ok=True) -os.makedirs(TEMP_PATH, exist_ok=True) +ESSENTIAL_DIR.mkdir(parents=True, exist_ok=True) +MANEGE_DIR.mkdir(parents=True, exist_ok=True) +TEMP_PATH.mkdir(parents=True, exist_ok=True) @driver.on_startup @@ -368,7 +367,7 @@ async def _(): async def _clear_cache(): try: shutil.rmtree(TEMP_PATH) - os.makedirs(TEMP_PATH, exist_ok=True) + TEMP_PATH.mkdir(parents=True, exist_ok=True) except Exception: log.warning("清除缓存失败,请手动清除:data/temp") |