mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 21:06:03 +00:00
feat: 支持插件热重载
This commit is contained in:
@@ -4,6 +4,7 @@ import threading
|
||||
import importlib
|
||||
import pkgutil
|
||||
import pkg.utils.context
|
||||
import pkg.plugin.host
|
||||
|
||||
|
||||
def walk(module, prefix=''):
|
||||
@@ -32,9 +33,12 @@ def reload_all(notify=True):
|
||||
importlib.reload(__import__('config'))
|
||||
importlib.reload(__import__('main'))
|
||||
importlib.reload(__import__('banlist'))
|
||||
importlib.reload(__import__('plugins'))
|
||||
pkg.utils.context.context = context
|
||||
|
||||
# 重载插件
|
||||
import plugins
|
||||
walk(plugins)
|
||||
|
||||
# 执行启动流程
|
||||
logging.info("执行程序启动流程")
|
||||
threading.Thread(target=main.main, args=(False,), daemon=False).start()
|
||||
|
||||
Reference in New Issue
Block a user