Skip to content

Commit

Permalink
🐛 version 1.8.2
Browse files Browse the repository at this point in the history
fix `command_manager.get_shortcuts`
  • Loading branch information
RF-Tar-Railt committed Mar 1, 2024
1 parent a44b297 commit 9636e7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 更新日志

## Alconna 1.8.2

### 修复

- 修复 `manager.get_shortcuts` 的错误

## Alconna 1.8.1

### 破坏性改动
Expand Down
2 changes: 1 addition & 1 deletion src/arclet/alconna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions src/arclet/alconna/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9636e7d

Please sign in to comment.