mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2025-09-06 11:30:46 +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 json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
require("nonebot_plugin_localstore")
|
require("nonebot_plugin_localstore")
|
||||||
import nonebot_plugin_localstore as store
|
import nonebot_plugin_localstore as store
|
||||||
|
|
||||||
|
require("nonebot_plugin_apscheduler")
|
||||||
|
from nonebot_plugin_apscheduler import scheduler
|
||||||
|
|
||||||
__plugin_meta__ = PluginMetadata(
|
__plugin_meta__ = PluginMetadata(
|
||||||
name="llmchat",
|
name="llmchat",
|
||||||
description="支持多API预设配置的AI群聊插件",
|
description="支持多API预设配置的AI群聊插件",
|
||||||
|
@ -332,10 +334,8 @@ async def load_state():
|
||||||
async def init_plugin():
|
async def init_plugin():
|
||||||
logger.info("插件启动初始化")
|
logger.info("插件启动初始化")
|
||||||
await load_state()
|
await load_state()
|
||||||
scheduler = AsyncIOScheduler()
|
|
||||||
# 每5分钟保存状态
|
# 每5分钟保存状态
|
||||||
scheduler.add_job(save_state, 'interval', minutes=5)
|
scheduler.add_job(save_state, 'interval', minutes=5)
|
||||||
scheduler.start()
|
|
||||||
|
|
||||||
@driver.on_shutdown
|
@driver.on_shutdown
|
||||||
async def cleanup_plugin():
|
async def cleanup_plugin():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue