Compatible with cross-platform superusers (#642)

This commit is contained in:
Jigsaw 2021-12-26 18:46:54 +08:00 committed by GitHub
parent 8093c5d154
commit fd9ec5e6fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,9 +206,10 @@ def USER(*users: str, perm: Optional[Permission] = None):
class SuperUser:
async def __call__(self, bot: Bot, event: Event) -> bool:
return (
event.get_type() == "message"
and event.get_user_id() in bot.config.superusers
return event.get_type() == "message" and (
f"{bot.adapter.get_name().split(maxsplit=1)[0].lower()}:{event.get_user_id()}"
in bot.config.superusers
or event.get_user_id() in bot.config.superusers # 兼容旧配置
)