From a2469b45f463ede803a7c27cc36b0de2339be3cd Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Thu, 27 Dec 2018 20:33:28 +0800 Subject: [PATCH] Adjust kill_current_session() function --- docs/api.md | 5 ++--- nonebot/command.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/api.md b/docs/api.md index 69a73a56..1e8defc4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1478,7 +1478,7 @@ sidebar: auto 从内部调用 `say` 命令,且不检查权限。 -### `kill_current_session(bot, ctx)` +### `kill_current_session(ctx)` - **说明:** @@ -1486,7 +1486,6 @@ sidebar: auto - **参数:** - - `bot: NoneBot`: NoneBot 对象 - `ctx: Context_T`: 事件上下文对象 - **返回:** @@ -1498,7 +1497,7 @@ sidebar: auto ```python @on_command('kill', privileged=True) async def _(session: CommandSession): - kill_current_session(session.bot, session.ctx) + kill_current_session(session.ctx) ``` 在特权命令 `kill` 中强行移除当前正在运行的会话。 diff --git a/nonebot/command.py b/nonebot/command.py index 0bef2768..38fdc5ec 100644 --- a/nonebot/command.py +++ b/nonebot/command.py @@ -603,12 +603,11 @@ async def _real_run_command(session: CommandSession, raise e # this is intended to be propagated to handle_message() -def kill_current_session(bot: NoneBot, ctx: Context_T) -> None: +def kill_current_session(ctx: Context_T) -> None: """ Force kill current session of the given context, despite whether it is running or not. - :param bot: NoneBot instance :param ctx: message context """ ctx_id = context_id(ctx)