Little improve

This commit is contained in:
Richard Chien
2018-07-06 14:24:18 +08:00
parent 946d0a11cd
commit 1b3980b5d2
2 changed files with 3 additions and 5 deletions

View File

@ -89,7 +89,7 @@ def on_command(name: Union[str, Tuple[str]], *,
if not name:
raise ValueError('the name of a command must not be empty')
cmd_name = name if isinstance(name, tuple) else (name,)
cmd_name = (name,) if isinstance(name, str) else name
current_parent = _registry
for parent_key in cmd_name[:-1]:
current_parent[parent_key] = current_parent.get(parent_key) or {}