mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-05 05:16:03 +00:00
feat: 适配aiocqhttp
This commit is contained in:
@@ -63,19 +63,24 @@ class Application:
|
||||
async def initialize(self):
|
||||
pass
|
||||
|
||||
# async def wait_loop(self):
|
||||
|
||||
async def run(self):
|
||||
await self.plugin_mgr.load_plugins()
|
||||
await self.plugin_mgr.initialize_plugins()
|
||||
|
||||
tasks = []
|
||||
|
||||
try:
|
||||
tasks = [
|
||||
asyncio.create_task(self.im_mgr.run()),
|
||||
asyncio.create_task(self.ctrl.run())
|
||||
]
|
||||
await asyncio.wait(tasks)
|
||||
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
||||
|
||||
except asyncio.CancelledError:
|
||||
self.logger.info("程序退出.")
|
||||
pass
|
||||
except Exception as e:
|
||||
self.logger.error(f"应用运行致命异常: {e}")
|
||||
self.logger.debug(f"Traceback: {traceback.format_exc()}")
|
||||
self.logger.info("程序退出.")
|
||||
|
||||
@@ -44,6 +44,7 @@ async def init_logging() -> logging.Logger:
|
||||
handler.setFormatter(color_formatter)
|
||||
qcg_logger.addHandler(handler)
|
||||
|
||||
qcg_logger.debug("日志初始化完成,日志级别:%s" % level)
|
||||
logging.basicConfig(
|
||||
level=logging.INFO, # 设置日志输出格式
|
||||
format="[DEPR][%(asctime)s.%(msecs)03d] %(pathname)s (%(lineno)d) - [%(levelname)s] :\n%(message)s",
|
||||
|
||||
Reference in New Issue
Block a user