예제 #1
0
파일: CQ.cs 프로젝트: balrogsxt/xtBot
        /// <summary>
        /// 获取群员列表数据
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public static List <GroupUser> getGroupUserList(long group)
        {
            int    ac       = CQAPI.getAuthCode();
            string jsonData = CQAPI.getGroupUserList(ac, group);

            try {
                JArray           list = JArray.Parse(jsonData);
                List <GroupUser> data = new List <GroupUser>();
                for (int i = 0; i < list.Count; i++)
                {
                    GroupUser gu = new GroupUser();
                    gu.setName(list[i]["name"].ToString());
                    gu.setQQId(int.Parse(list[i]["qqid"].ToString()));
                    gu.setCard(list[i]["card"].ToString());
                    gu.setSex(int.Parse(list[i]["sex"].ToString()));
                    gu.setAge(int.Parse(list[i]["age"].ToString()));
                    gu.setAddress(list[i]["address"].ToString());

                    gu.setJoinTime(long.Parse(list[i]["joinTime"].ToString()));
                    gu.setLastTime(long.Parse(list[i]["lastTime"].ToString()));
                    gu.setRule(int.Parse(list[i]["rule"].ToString()));
                    data.Add(gu);
                }
                return(data);
            } catch (Exception e) {
                return(null);
            }
        }
예제 #2
0
파일: CQ.cs 프로젝트: balrogsxt/xtBot
        /// <summary>
        /// 获取群员列表数量
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public static int getGroupUserListSize(long group)
        {
            int    ac       = CQAPI.getAuthCode();
            string jsonData = CQAPI.getGroupUserList(ac, group);

            try {
                JArray list = JArray.Parse(jsonData);
                return(list.Count);
            } catch (Exception e) {
                return(0);
            }
        }