diff options
author | Kyomotoi <[email protected]> | 2021-10-24 16:47:29 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-10-24 16:47:29 +0800 |
commit | 16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a (patch) | |
tree | 77630910cac9cc38396cabe3dcc11e2d856a6c2f /ATRI/plugins/essential.py | |
parent | d789b1ae77f4415dab062c4af516e303dc447ddc (diff) | |
download | ATRI-16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a.tar.gz ATRI-16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a.tar.bz2 ATRI-16838e0d83c8dd3f1be1e6ec5fb1cecd9b319d8a.zip |
🔖 更新版本:YHN-001-A04
新增:
- nsfw检测(主动/被动) 又名 涩图嗅探
- 可选代理
修复:
- plugin/chat 在 nb2-a14+ 版本 finish 内为空时会报错
其他:
- 对定时任务进行中文命名
Diffstat (limited to 'ATRI/plugins/essential.py')
-rw-r--r-- | ATRI/plugins/essential.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ATRI/plugins/essential.py b/ATRI/plugins/essential.py index 3bbf66e..4cc0ac2 100644 --- a/ATRI/plugins/essential.py +++ b/ATRI/plugins/essential.py @@ -1,5 +1,6 @@ import os import json +import shutil import asyncio from datetime import datetime from pydantic.main import BaseModel @@ -30,14 +31,19 @@ from ATRI.service import Service from ATRI.log import logger as log from ATRI.config import BotSelfConfig from ATRI.utils import CoolqCodeChecker +from ATRI.utils.apscheduler import scheduler + driver = ATRI.driver() 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) @driver.on_startup @@ -298,3 +304,11 @@ async def _recall_private_event(bot: Bot, event: FriendRecallNoticeEvent): msg = "主人,咱拿到了一条撤回信息!\n" f"{user}@[私聊]" "撤回了\n" f"{repo}" for superuser in BotSelfConfig.superusers: await bot.send_private_msg(user_id=int(superuser), message=msg) + + [email protected]_job("interval", name="清除缓存", minutes=30, misfire_grace_time=5) +async def _clear_cache(): + try: + shutil.rmtree(TEMP_PATH) + except Exception: + log.warning("清除缓存失败,请手动清除:data/temp") |