Browse SDKs · uni-app / uni-app x
SDKsuni-app

Manage group administrators

OpenIM uni-app / uni-app x SDK guide for Manage group administrators.

Copy

Use roleLevel to promote a regular member to administrator or remove administrator status.

import { setGroupMemberInfo } from '@/uni_modules/unix-openim-sdk'

await setGroupMemberInfo({ groupID, userID: 'user_b', roleLevel: 60 })

The role values are:

roleLevelMeaning
20Regular member.
60Group administrator.
100Group owner; use for identification only.

Pass 60 to create an administrator and 20 to remove administrator status. Although OpenIMGroupMemberRoleLevel permits 100, writing it is not the ownership-transfer operation; use Transfer group ownership.

Require confirmation for this high-risk moderation action and let the server enforce authority. After Promise success, merge onGroupMemberInfoChanged by groupID:userID.