🔨 use nonebot_plugin_apscheduler

This commit is contained in:
FuQuan233 2025-02-14 20:32:23 +08:00
parent a87d3e64ff
commit 4947fccdd3

View file

@ -16,12 +16,14 @@ import time
import json
import os
import random
from apscheduler.schedulers.asyncio import AsyncIOScheduler
import time
require("nonebot_plugin_localstore")
import nonebot_plugin_localstore as store
require("nonebot_plugin_apscheduler")
from nonebot_plugin_apscheduler import scheduler
__plugin_meta__ = PluginMetadata(
name="llmchat",
description="支持多API预设配置的AI群聊插件",
@ -332,10 +334,8 @@ async def load_state():
async def init_plugin():
logger.info("插件启动初始化")
await load_state()
scheduler = AsyncIOScheduler()
# 每5分钟保存状态
scheduler.add_job(save_state, 'interval', minutes=5)
scheduler.start()
@driver.on_shutdown
async def cleanup_plugin():