"""独立签到插件 - 权限纯函数(无 nonebot 依赖,便于单元测试)。""" from typing import Optional def is_allowed( user_id: int, group_id: Optional[int], *, allowed_group_id: int, allowed_user_id: int, ) -> bool: """签到权限纯函数:管理员任意场景可用;其他用户仅白名单群聊可用。 Args: user_id: 消息发送者 QQ group_id: 群聊 ID,非群聊场景为 None allowed_group_id: 白名单群聊 allowed_user_id: 管理员 QQ """ if user_id == allowed_user_id: return True return group_id is not None and group_id == allowed_group_id