mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 03:15:06 +08:00
23 lines
557 B
Python
23 lines
557 B
Python
from ..mgr import AbstractCommandNode, Context
|
|
import threading
|
|
|
|
@AbstractCommandNode.register(
|
|
parent=None,
|
|
name="reload",
|
|
description="执行热重载",
|
|
usage="!reload",
|
|
aliases=[],
|
|
privilege=2
|
|
)
|
|
class ReloadCommand(AbstractCommandNode):
|
|
@classmethod
|
|
def process(cls, ctx: Context) -> tuple[bool, list]:
|
|
reply = []
|
|
|
|
import pkg.utils.reloader
|
|
def reload_task():
|
|
pkg.utils.reloader.reload_all()
|
|
|
|
threading.Thread(target=reload_task, daemon=True).start()
|
|
|
|
return True, reply |