🐛 fix rule and permission not handle skip

This commit is contained in:
yanyongyu
2021-12-01 19:21:31 +08:00
parent a414406039
commit 0236746e65
2 changed files with 21 additions and 13 deletions

View File

@ -16,6 +16,7 @@ from typing import Any, Dict, List, Type, Union, Callable, NoReturn, Optional
from nonebot import params
from nonebot.handler import Handler
from nonebot.adapters import Bot, Event
from nonebot.exception import SkippedException
from nonebot.typing import T_PermissionChecker
@ -96,9 +97,13 @@ class Permission:
_dependency_cache=dependency_cache,
)
for checker in self.checkers
)
),
return_exceptions=True,
)
return next(
filter(lambda x: bool(x) and not isinstance(x, SkippedException), results),
False,
)
return any(results)
def __and__(self, other) -> NoReturn:
raise RuntimeError("And operation between Permissions is not allowed.")