From 4947fccdd382bcbfe001ae5985c4243518bcafe3 Mon Sep 17 00:00:00 2001 From: FuQuan233 Date: Fri, 14 Feb 2025 20:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20use=20nonebot=5Fplugin=5Fapsched?= =?UTF-8?q?uler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_llmchat/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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():