• UIKit
  • SDK
  • サーバー API
Chat/
SDK/
React Native/
グループ/
SDK
  • Run Demo
  • SDK の統合
  • 初期化
  • ログインとログアウト
  • メッセージ
    • メッセージの概要
    • メッセージ送信
    • メッセージの受信
    • 過去のメッセージ
    • メッセージ転送
    • メッセージの変更
    • メッセージ挿入
    • メッセージ削除
    • メッセージをクリア
    • メッセージの取り消し
    • オンラインメッセージ
    • 既読レシート
    • クエリーメッセージ
    • グループ @ メッセージ
    • ターゲットグループメッセージ
    • 通知のサイレントモード
    • メッセージ拡張
  • グループ
    • Overview
    • グループ管理
    • グループプロファイル
    • グループメンバーの管理
    • グループメンバープロファイル
    • グループプロパティのカスタマイズ
    • コミュニティ管理
  • ユーザー
    • ユーザープロファイル
    • 友達管理
    • 友達リスト
    • ブラックリスト
  • オフラインプッシュ
    • オフラインプッシュ
  • ローカル検索
    • メッセージ検索
    • 友達を検索
    • グループの検索
    • グループメンバーの検索
  • シグナリング
    • シグナリング管理
  • Changelog
  • Guideline for Beginners
  • コンソールガイド
    • アプリケーションの作成とアップグレード
    • 基本設定
    • 機能設定
    • アカウント管理
    • グループ管理
    • コールバック設定
  • 製品紹介
    • メッセージ管理
      • シングルチャットメッセージ
      • メッセージの保存
      • オフラインプッシュ
      • グループメッセージ
      • メッセージフォーマット
    • アカウントシステム
      • ログイン認証
      • オンライン状態管理
    • グループ関連
      • グループシステム
      • グループ管理
    • ユーザープロファイルとリレーションシップチェーン
      • 資料管理
      • リレーションシップチェーン管理
  • 購入ガイド
    • 課金の概要
    • 価格
  • エラーコード
このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

グループメンバーの管理

Feature Description

Group member management includes pulling the member list, muting group members, removing group members, granting permissions, and transferring the group ownership, which can be implemented through the methods in the TencentImSDKPlugin.v2TIMManager.getGroupManager() core class.


Getting the Group Member List

You can call getGroupMemberList (Details) to get the list of members in a specified group. This list contains the profile information of each member, such as user ID (userID), group name card (nameCard), profile photo (faceUrl), nickname (nickName), and time for joining the group (joinTime).
A group may have a large number of members (for example, more than 5,000). In this case, you can use the filter (filter) and paged pull (nextSeq) advanced features of the API for pulling the group member list.

Filter (filter)

Call the getGroupMemberList API (Details) to specify the filter to determine whether to pull the list of the information of specified roles.
Filter
Type
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ALL
Pull the list of the information of all the group members
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_OWNER
Pull the list of the information of the group owner
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ADMIN
Pull the list of the information of the group admin
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_COMMON
Pull the list of the information of ordinary group members
Below is the sample code:
// Specify to pull the profile of the group owner through the `filter` parameter
const groupID = "groupID";
const count = 10;
const filter = GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ADMIN;
const offset = 0;
const nextSeq = "0";
groupManager.getGroupMemberList(groupID, filter, nextSeq, count, offset);

Paged pull (nextSeq)

In many cases, only the first page of the group member list, not the information of all the group members, needs to be displayed on the user UI. More group members need to be pulled only when the user clicks Next Page or pulls up the list page. In this case, you can use paged pull.
Directions for paged pull:
1. When you call getGroupMemberList for the first time, set nextSeq to 0 (indicating to pull the group member list from the beginning). Up to 50 group member objects can be pulled at a time.
2. After the group member list is pulled successfully for the first time, the V2TIMGroupMemberInfoResult callback of getGroupMemberList will contain nextSeq (field for the next pull):
If nextSeq is 0, all the group members have been pulled.
If nextSeq is greater than 0, there are more group members that can be pulled. This does not mean that the next page of the member list will be pulled immediately. In common communications software, a paged pull is often triggered by a swipe operation.
3. When the user continues to pull up the group member list, if there are more members that can be pulled, you can continue to call the getGroupMemberList API and pass in the nextSeq parameter (the value is from the V2TIMGroupMemberInfoResult object returned by the last pull) for the next pull.
4. Repeat [step 3] until nextSeq is 0.
Below is the sample code:
// Specify to pull the profile of the group owner through the `filter` parameter
const groupID = "groupID";
const count = 10;
const filter = GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ADMIN;
const offset = 0;
const nextSeq = "0";
groupManager.getGroupMemberList(groupID, filter, nextSeq, count, offset);


Muting

Muting a specified group member

The group owner or admin can call muteGroupMember (Details) to mute a specified group member and set the muting period in seconds. The muting information is stored in the muteUtil attribute of the group member.
After a group member is muted, all the group members (including the muted member) will receive the onMemberInfoChanged callback (Details).

Muting the entire group

The group owner or admin can also call the setGroupInfo API (Details) to mute the entire group by setting the allMuted attribute to true. The entire group can be muted for an unlimited period of time and needs to be unmuted through setAllMuted(false) of the group profile.
Note:
Muting all the group members will trigger the onGroupInfoChanged callback (Details). This feature is disabled by default and can be enabled in the console. Directions: Go to the Group configuration module in the IM console, select Group system notification configuration, click Edit in the Operation column, and modify Notification of muting all change. Only the group owner can mute the admin.
Below is the sample code:
// Mute the `userB` group member for 10 seconds
const groupID = "groupID";
const userID = "userID";
const seconds = 10;
groupManager.muteGroupMember(groupID, userID, seconds);

// Mute all the members
groupManager.setGroupInfo({
isAllMuted: true,
groupID: "",
groupType: "Public",
});

TencentImSDKPlugin.v2TIMManager.addGroupListener({
onMemberInfoChanged: (groupID, v2TIMGroupMemberChangeInfoList) => {
// The group member information is changed.
},
onGroupInfoChanged: (groupID, info) => {
// The group information is changed.
},
});


Removing a Group Member

The group owner or admin can call the kickGroupMember API (Details) to remove a specified ordinary group member from the group.
After the ordinary group member is removed, all the members (including the removed member) will receive the onMemberKicked callback (Details).
As there are no limits on joining an audio-video group (AVChatRoom), there is no API for removing a group member from an audio-video group (AVChatRoom). You can use muteGroupMember (Details) to mute a specified member to implement similar controls. For detailed directions, see muteGroupMember.
Note:
Only the group member can remove the admin from the group.
Below is the sample code:
groupManager.kickGroupMember("groupID", []);

Setting as Admin

The group owner can call setGroupMemberRole (Details) to set a group member in a public group (Public) or meeting group (Meeting) as the admin.
An ordinary member set as the admin has the admin permission to perform the following operations:
Modify the basic group profile.
Remove an ordinary member from the group.
Mute an ordinary member (prevent the member from speaking during a specified period of time).
Approve a request to join the group.
For more information, see Group System.
After an ordinary member is set as the admin, all the members (including the ordinary member) will receive the onGrantAdministrator callback (Details).
After the ordinary member is unset as the admin, all the members (including the ordinary member) will receive the onRevokeAdministrator callback (Details).
Below is the sample code:
groupManager.setGroupMemberRole(
"groupID",
"userID",
GroupMemberRoleTypeEnum.V2TIM_GROUP_MEMBER_ROLE_ADMIN
);

// Listen for the role change
TencentImSDKPlugin.v2TIMManager.addGroupListener({
onMemberInfoChanged: (groupID, v2TIMGroupMemberChangeInfoList) => {},
onGroupInfoChanged: (groupID, info) => {},
onGrantAdministrator: (groupID, info, infolist) => {},
onRevokeAdministrator: (groupID, info, infolist) => {},
});


Transferring the Group Ownership

The group owner can call transferGroupOwner to transfer the group ownership to a group member.
After the group ownership is transferred, all group members receive the onGroupInfoChanged callback, where the type of V2TIMGroupChangeInfo is V2TIMGroupChangeInfo.V2TIM_GROUP_INFO_CHANGE_TYPE_OWNER and the value is the UserID of the new group owner.
Below is the sample code:
groupManager.transferGroupOwner("groupID", "userID");

Getting the Number of Online Group Members

Call getGroupOnlineMemberCount (Details) to get the number of online group members.
Note:
1. Currently, only the number of online members in an audio-video group (AVChatRoom) can be obtained.
2. The SDK can be called once every 60 seconds.
Below is the sample code:
groupManager.getGroupOnlineMemberCount("groupID");