🐛 Fix: 内置规则和权限没有捕获错误 (#1291)

This commit is contained in:
Ju4tCode
2022-09-29 16:56:06 +08:00
committed by GitHub
parent ab85b8651e
commit 71aad502d1
6 changed files with 113 additions and 56 deletions

View File

@ -132,9 +132,12 @@ class User:
)
async def __call__(self, bot: Bot, event: Event) -> bool:
try:
session = event.get_session_id()
except Exception:
return False
return bool(
event.get_session_id() in self.users
and (self.perm is None or await self.perm(bot, event))
session in self.users and (self.perm is None or await self.perm(bot, event))
)