Skip to content

Commit 9636e7d

Browse files
committed
🐛 version 1.8.2
fix `command_manager.get_shortcuts`
1 parent a44b297 commit 9636e7d

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# 更新日志
22

3+
## Alconna 1.8.2
4+
5+
### 修复
6+
7+
- 修复 `manager.get_shortcuts` 的错误
8+
39
## Alconna 1.8.1
410

511
### 破坏性改动

src/arclet/alconna/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from .typing import UnpackVar as UnpackVar
5151
from .typing import Up as Up
5252

53-
__version__ = "1.8.1"
53+
__version__ = "1.8.2"
5454

5555
# backward compatibility
5656
AnyOne = ANY

src/arclet/alconna/manager.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,9 @@ def get_shortcut(self, target: Alconna[TDC]) -> dict[str, Union[Arparma[TDC], In
231231
dict[str, Arparma | InnerShortcutArgs]: 快捷命令的参数
232232
"""
233233
namespace, name = self._command_part(target.path)
234-
if f"{namespace}.{name}" not in self.__shortcuts:
234+
if target not in self.__analysers:
235235
raise ValueError(lang.require("manager", "undefined_command").format(target=f"{namespace}.{name}"))
236-
if not (_shortcut := self.__shortcuts.get(f"{namespace}.{name}")):
237-
return {}
238-
return _shortcut
236+
return self.__shortcuts.get(f"{namespace}.{name}", {})
239237

240238
def find_shortcut(
241239
self, target: Alconna[TDC], data: list

0 commit comments

Comments
 (0)