GroupGetMemberInfoList
(Details) 获取指定群的群成员列表。该列表中包含了各个群成员的资料信息,例如用户ID(group_member_info_identifier
)、群名片(group_member_info_name_card
)、头像(group_member_info_face_url
)、昵称(group_member_info_nick_name
)、进群时间(group_member_info_join_time
)等信息。group_get_members_info_list_param_option
)和分页拉取(group_get_members_info_list_param_next_seq
)两个高级特性。过滤器 | 过滤类型 |
TIMGroupMemberRoleFlag.kTIMGroupMemberRoleFlag_All | 拉取所有群成员的信息列表 |
TIMGroupMemberRoleFlag.kTIMGroupMemberRoleFlag_Owner | 仅拉取群主的信息列表 |
TIMGroupMemberRoleFlag.kTIMGroupMemberRoleFlag_Admin | 仅拉取群管理员的信息列表 |
TIMGroupMemberRoleFlag.kTIMGroupMemberRoleFlag_Member | 仅拉取普通群成员的信息列表 |
// 通过 filter 参数指定只拉取群主的资料GroupGetMemberInfoListParam param = new GroupGetMemberInfoListParam{group_get_members_info_list_param_group_id = "group_id",group_get_members_info_list_param_option = new GroupMemberGetInfoOption{group_member_get_info_option_role_flag = TIMGroupMemberRoleFlag.kTIMGroupMemberRoleFlag_Owner}};TIMResult res = TencentIMSDK.GroupGetMemberInfoList(param, (int code, string desc, GroupGetMemberInfoListResult result, string user_data)=>{// 处理异步逻辑});
GroupGetMemberInfoList
时,指定参数 nextSeq
为 0(表示从头开始拉取会话列表),一次最多拉取 50 个群成员对象。GroupGetMemberInfoList
的回调结果 GroupGetMemberInfoListResult
中会包含 group_get_memeber_info_list_result_next_seq
(下次分页拉取的字段):nextSeq
等于 0,表示已经拉取了全部的群成员。nextSeq
大于 0,表示还有更多的群成员可以拉取。此时并不意味着要立刻开始拉取 “下一页” 的成员列表。在常见的通信软件中,分页拉取通常由用户的滑动操作触发的,用户通过上拉触发一次分页拉取。GroupGetMemberInfoList
接口,并传入新一轮的 nextSeq
参数(nextSeq
数值来自上一次拉取返回的 GroupGetMemberInfoListResult
对象)。nextSeq
等于 0,拉取结束。// 通过 filter 参数指定只拉取群主的资料GroupGetMemberInfoListParam param = new GroupGetMemberInfoListParam{group_get_members_info_list_param_group_id = "group_id",group_get_members_info_list_param_option = new GroupMemberGetInfoOption{group_member_get_info_option_role_flag = TIMGroupMemberRoleFlag.kTIMGroupMemberRoleFlag_Owner},group_get_members_info_list_param_next_seq = 0};TIMResult res = TencentIMSDK.GroupGetMemberInfoList(param, (int code, string desc, GroupGetMemberInfoListResult result, string user_data)=>{// 处理异步逻辑});
GroupModifyMemberInfo
(Details) 禁言某一个群成员并设置禁言时间。禁言时间单位为秒,禁言信息存储于群成员的 group_member_info_shutup_time
属性字段中。GroupModifyGroupInfo
(Details) 接口对整个群进行禁言,将 group_modify_info_param_is_shutup_all
属性字段设置为 true
即可。全群禁言没有时间限制,需通过将群资料 group_modify_info_param_is_shutup_all
修改为 false
解除禁言。// 禁言群成员 userB 10分钟GroupModifyMemberInfoParam param = new GroupModifyMemberInfoParam{group_modify_member_info_group_id = "group_id",group_modify_member_info_identifier = "userB",group_modify_member_info_modify_flag = TIMGroupMemberModifyInfoFlag.kTIMGroupMemberModifyFlag_ShutupTime,group_modify_member_info_shutup_time = 600};TIMResult res = TencentIMSDK.GroupModifyMemberInfo(param, (int code, string desc, string user_data)=>{// 处理异步逻辑});// 全员禁言GroupModifyInfoParam param = new GroupModifyInfoParam{group_modify_info_param_group_id = "group_id",group_modify_info_param_modify_flag = TIMGroupModifyInfoFlag.kTIMGroupModifyInfoFlag_ShutupAll,group_modify_info_param_is_shutup_all = true};TIMResult res = TencentIMSDK.GroupModifyGroupInfo(param, (int code, string desc, string user_data)=>{// 处理异步逻辑});
GroupModifyMemberInfo
(Details) 禁言指定成员达到类似的成员管控的目的。GroupDeleteMemberParam param = new GroupDeleteMemberParam{group_delete_member_param_group_id = "group_id",group_delete_member_param_identifier_array = new List<string>{"user_id"}};TIMResult res = TencentIMSDK.GroupDeleteMember(param, (int code, string desc, List<GroupDeleteMemberResult> result, string user_data)=>{// 处理异步逻辑});
GroupModifyMemberInfoParam param = new GroupModifyMemberInfoParam{group_modify_member_info_group_id = "group_id",group_modify_member_info_identifier = "user_id",group_modify_member_info_modify_flag = TIMGroupMemberModifyInfoFlag.kTIMGroupMemberModifyFlag_MemberRole,group_modify_member_info_member_role = TIMGroupMemberRole.kTIMMemberRole_Admin};TIMResult res = TencentIMSDK.GroupModifyMemberInfo(param, (int code, string desc, string user_data)=>{// 处理异步逻辑});
GroupModifyMemberInfoParam param = new GroupModifyMemberInfoParam{group_modify_member_info_group_id = "group_id",group_modify_member_info_identifier = "user_id",group_modify_member_info_modify_flag = TIMGroupMemberModifyInfoFlag.kTIMGroupMemberModifyFlag_MemberRole,group_modify_member_info_member_role = TIMGroupMemberRole.kTIMMemberRole_Owner};TIMResult res = TencentIMSDK.GroupModifyMemberInfo(param, (int code, string desc, string user_data)=>{// 处理异步逻辑});
TIMResult res = TencentIMSDK.GroupGetOnlineMemberCount("group_id", (int code, string desc, GroupGetOnlineMemberCountResult result, string user_data)=>{// 处理异步逻辑});
本页内容是否解决了您的问题?