mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +08:00
Fix command finding bug
This commit is contained in:
parent
034f121cc0
commit
f38c3e1c30
@ -4,6 +4,10 @@ sidebar: auto
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## next
|
||||||
|
|
||||||
|
- 修复调用不存在的多级命令(例如 `/echo/nonexist`)时,抛出异常导致 WebSocket 连接断开的问题
|
||||||
|
|
||||||
## v0.4.3
|
## v0.4.3
|
||||||
|
|
||||||
- 自然语言处理器支持响应只有机器人昵称而没有实际内容的消息,通过 `on_natural_language` 的 `allow_empty_message` 参数开启(默认关闭)
|
- 自然语言处理器支持响应只有机器人昵称而没有实际内容的消息,通过 `on_natural_language` 的 `allow_empty_message` 参数开启(默认关闭)
|
||||||
|
@ -164,7 +164,7 @@ def _find_command(name: Union[str, CommandName_T]) -> Optional[Command]:
|
|||||||
|
|
||||||
cmd_tree = _registry
|
cmd_tree = _registry
|
||||||
for part in cmd_name[:-1]:
|
for part in cmd_name[:-1]:
|
||||||
if part not in cmd_tree:
|
if part not in cmd_tree or not isinstance(cmd_tree[part], dict):
|
||||||
return None
|
return None
|
||||||
cmd_tree = cmd_tree[part]
|
cmd_tree = cmd_tree[part]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user