MCPcopy
hub / github.com/AstrBotDevs/AstrBot / start

Method start

astrbot/core/initial_loader.py:26–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24 self.webui_dir: str | None = None
25
26 async def start(self) -> None:
27 core_lifecycle = AstrBotCoreLifecycle(self.log_broker, self.db)
28
29 try:
30 await core_lifecycle.initialize()
31 except Exception as e:
32 logger.critical(traceback.format_exc())
33 logger.critical(f"😭 初始化 AstrBot 失败:{e} !!!")
34 return
35
36 core_task = core_lifecycle.start()
37
38 webui_dir = self.webui_dir
39
40 self.dashboard_server = AstrBotDashboard(
41 core_lifecycle,
42 self.db,
43 core_lifecycle.dashboard_shutdown_event,
44 webui_dir,
45 )
46
47 coro = self.dashboard_server.run()
48 if coro:
49 # 启动核心任务和仪表板服务器
50 task = asyncio.gather(core_task, coro)
51 else:
52 task = core_task
53 try:
54 await task # 整个AstrBot在这里运行
55 except asyncio.CancelledError:
56 logger.info("🌈 正在关闭 AstrBot...")
57 await core_lifecycle.stop()

Callers 2

main_asyncFunction · 0.95
run_astrbotFunction · 0.95

Calls 7

initializeMethod · 0.95
startMethod · 0.95
stopMethod · 0.95
AstrBotDashboardClass · 0.90
infoMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected