From 7174cbf41fdda7b575da7761f7ca2ef1ae8d7520 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Thu, 15 Feb 2024 22:21:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20ctrl+c=20=E9=80=80?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/core/app.py | 4 +--- pkg/platform/sources/aiocqhttp.py | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/core/app.py b/pkg/core/app.py index ee901ba5..2344c346 100644 --- a/pkg/core/app.py +++ b/pkg/core/app.py @@ -65,8 +65,6 @@ 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() @@ -83,7 +81,7 @@ class Application: async def interrupt(tasks): await asyncio.sleep(1.5) - while await aioconsole.ainput("使用 exit 退出程序 > ") != 'exit': + while await aioconsole.ainput("使用 ctrl+c 或 'exit' 退出程序 > ") != 'exit': pass for task in tasks: task.cancel() diff --git a/pkg/platform/sources/aiocqhttp.py b/pkg/platform/sources/aiocqhttp.py index a3f4240e..e98034f3 100644 --- a/pkg/platform/sources/aiocqhttp.py +++ b/pkg/platform/sources/aiocqhttp.py @@ -207,6 +207,12 @@ class AiocqhttpAdapter(adapter.MessageSourceAdapter): def __init__(self, config: dict, ap: app.Application): self.config = config + + async def shutdown_trigger_placeholder(): + return None + + self.config['shutdown_trigger'] = shutdown_trigger_placeholder + self.ap = ap self.bot = aiocqhttp.CQHttp()