MCPcopy Create free account
hub / github.com/AstrBotDevs/AstrBot / initialize

Method initialize

astrbot/core/platform/manager.py:87–100  ·  view source on GitHub ↗

初始化所有平台适配器

(self)

Source from the content-addressed store, hash-verified

85 await self._stop_platform_task(client_id)
86
87 async def initialize(self) -> None:
88 """初始化所有平台适配器"""
89 for platform in self.platforms_config:
90 try:
91 if ensure_platform_webhook_config(platform):
92 self.astrbot_config.save_config()
93 await self.load_platform(platform)
94 except Exception as e:
95 logger.error(f"初始化 {platform} 平台适配器失败: {e}")
96
97 # 网页聊天
98 webchat_inst = WebChatAdapter({}, self.settings, self.event_queue)
99 self.platform_insts.append(webchat_inst)
100 self._start_platform_task("webchat", webchat_inst)
101
102 async def load_platform(self, platform_config: dict) -> None:
103 """实例化一个平台"""

Callers

nothing calls this directly

Calls 7

load_platformMethod · 0.95
_start_platform_taskMethod · 0.95
WebChatAdapterClass · 0.85
save_configMethod · 0.45
errorMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected