diff --git a/nonebot_plugin_llmchat/__init__.py b/nonebot_plugin_llmchat/__init__.py index 4f49c0a..0be2745 100644 --- a/nonebot_plugin_llmchat/__init__.py +++ b/nonebot_plugin_llmchat/__init__.py @@ -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():