diff --git a/CHANGELOG.md b/CHANGELOG.md index 78834141..935f46fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +## Alconna 1.8.2 + +### 修复 + +- 修复 `manager.get_shortcuts` 的错误 + ## Alconna 1.8.1 ### 破坏性改动 diff --git a/src/arclet/alconna/__init__.py b/src/arclet/alconna/__init__.py index 3f9a8389..dfaf2ff1 100644 --- a/src/arclet/alconna/__init__.py +++ b/src/arclet/alconna/__init__.py @@ -50,7 +50,7 @@ from .typing import UnpackVar as UnpackVar from .typing import Up as Up -__version__ = "1.8.1" +__version__ = "1.8.2" # backward compatibility AnyOne = ANY diff --git a/src/arclet/alconna/manager.py b/src/arclet/alconna/manager.py index a5e64405..0f8ab80e 100644 --- a/src/arclet/alconna/manager.py +++ b/src/arclet/alconna/manager.py @@ -231,11 +231,9 @@ def get_shortcut(self, target: Alconna[TDC]) -> dict[str, Union[Arparma[TDC], In dict[str, Arparma | InnerShortcutArgs]: 快捷命令的参数 """ namespace, name = self._command_part(target.path) - if f"{namespace}.{name}" not in self.__shortcuts: + if target not in self.__analysers: raise ValueError(lang.require("manager", "undefined_command").format(target=f"{namespace}.{name}")) - if not (_shortcut := self.__shortcuts.get(f"{namespace}.{name}")): - return {} - return _shortcut + return self.__shortcuts.get(f"{namespace}.{name}", {}) def find_shortcut( self, target: Alconna[TDC], data: list