mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 05:27:30 +08:00
Update
This commit is contained in:
parent
f02c8ec858
commit
4bc2b3c979
@ -27,9 +27,7 @@ class Command:
|
|||||||
self.func = func
|
self.func = func
|
||||||
self.permission = permission
|
self.permission = permission
|
||||||
|
|
||||||
async def run(self, bot, ctx, session,
|
async def run(self, bot, ctx, session) -> Any:
|
||||||
*args, **kwargs) -> Any:
|
|
||||||
# TODO: check permission
|
|
||||||
permission = 0
|
permission = 0
|
||||||
if ctx['user_id'] in bot.config.SUPERUSERS:
|
if ctx['user_id'] in bot.config.SUPERUSERS:
|
||||||
permission |= perm.IS_SUPERUSER
|
permission |= perm.IS_SUPERUSER
|
||||||
@ -69,7 +67,7 @@ def _find_command(name: Tuple[str]) -> Optional[Command]:
|
|||||||
cmd_tree = _registry
|
cmd_tree = _registry
|
||||||
for part in name[:-1]:
|
for part in name[:-1]:
|
||||||
if part not in cmd_tree:
|
if part not in cmd_tree:
|
||||||
return False
|
return None
|
||||||
cmd_tree = cmd_tree[part]
|
cmd_tree = cmd_tree[part]
|
||||||
|
|
||||||
return cmd_tree.get(name[-1])
|
return cmd_tree.get(name[-1])
|
||||||
|
Loading…
Reference in New Issue
Block a user