mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2025-09-04 10:20:45 +00:00
🔨 use nonebot_plugin_apscheduler
This commit is contained in:
parent
a87d3e64ff
commit
4947fccdd3
1 changed files with 3 additions and 3 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue