public async Task <bool> CheckPermission(long target = 0, GroupPermission required = GroupPermission.Administrator) { var qq = FromQQ; return(IsAdmin || ((target == 0 ? new IGroupMemberInfo[0] : await Session.GetGroupMemberListAsync(target)) .SingleOrDefault(info => info.Id == qq)?.Permission ?? GroupPermission.Member) >= required); }
public static async Task <List <Models.GroupMemberInfo> > GetMemberList(this MiraiHttpSession session, long groupId) { return((await session.GetGroupMemberListAsync(groupId)).Select(info => new Models.GroupMemberInfo { GroupId = groupId, QQId = info.Id, PermitType = info.Permission switch { GroupPermission.Owner => PermitType.Holder, GroupPermission.Administrator => PermitType.Manage, _ => PermitType.None } }).ToList());
public static Task <IGroupMemberInfo[]> GetGroupMemberListAsync(long groupID) => session.GetGroupMemberListAsync(groupID);