예제 #1
0
        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);
        }
예제 #2
0
 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());
예제 #3
0
 public static Task <IGroupMemberInfo[]> GetGroupMemberListAsync(long groupID)
 => session.GetGroupMemberListAsync(groupID);