初始化文件
This commit is contained in:
@@ -38,6 +38,9 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
def commands(self) -> List[str]:
|
||||
return ["总结", "summary"]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
try:
|
||||
|
||||
@@ -37,6 +37,9 @@ class MusicPlugin(MessagePluginInterface):
|
||||
def commands(self) -> List[str]:
|
||||
return self._commands
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
self.LOG = logging.getLogger(f"Plugin.{self.name}")
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
[StatsCollector]
|
||||
enable = true
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ class StatsCollectorPlugin(PluginInterface):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger("StatsCollector")
|
||||
|
||||
# 默认配置
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
[StatsDashBoard]
|
||||
enable = true
|
||||
|
||||
host = "127.0.0.1"
|
||||
port = 8080
|
||||
username = "admin"
|
||||
password = "admin123"
|
||||
auto_start = "True"
|
||||
@@ -34,40 +34,28 @@ class StatsDashboardPlugin(PluginInterface):
|
||||
return []
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger("StatsDashboard")
|
||||
|
||||
# 默认配置
|
||||
self.config = {
|
||||
"enable": True,
|
||||
"host": "127.0.0.1",
|
||||
"port": 8080,
|
||||
"username": "admin",
|
||||
"password": "admin123",
|
||||
"auto_start": True
|
||||
}
|
||||
|
||||
self.server = None
|
||||
self.server_thread = None
|
||||
|
||||
def initialize(self, config: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
if config:
|
||||
self.config.update(config)
|
||||
|
||||
if not self.config["enable"]:
|
||||
if not self._config["enable"]:
|
||||
self.logger.info("统计看板插件已禁用")
|
||||
return False
|
||||
|
||||
# 创建看板服务器
|
||||
self.server = DashboardServer(
|
||||
host=self.config["host"],
|
||||
port=self.config["port"],
|
||||
username=self.config["username"],
|
||||
password=self.config["password"]
|
||||
host=self._config["host"],
|
||||
port=self._config["port"],
|
||||
username=self._config["username"],
|
||||
password=self._config["password"]
|
||||
)
|
||||
|
||||
# 如果配置为自动启动,则启动服务器
|
||||
if self.config["auto_start"]:
|
||||
if self._config["auto_start"]:
|
||||
self.start_server()
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user