addToBlackList

Introduction

Add users to blacklist, the list of users been blocked.

  1. The blocked users can not find they have been blocked by their friends, as they will not receive any error code after sending messages as default.

  2. Also, you can let the blocked users know that they have been blocked, by enable the 'Blocklist Check' here, while blocked users will receive error code of 20007 when sending messages.

Parameter details

Parameter name Parameter type Required Description
userIDList string[] yes The list of users IDs to be blocked.

Returned template

V2TimValueCallback<V2TimFriendOperationResult[]>

{
    code : number
    desc : string
    data : V2TimFriendOperationResult[]
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.
data V2TimFriendOperationResult[] The list of operation result.

Code example

import { TencentImSDKPlugin } from 'react-native-tim-js';


const addToBlackListRes = await TencentImSDKPlugin.v2TIMManager
    .getFriendshipManager()
    .addToBlackList(
        []
    );
if (addToBlackListRes.code == 0) {

    addToBlackListRes.data?.forEach((element) => {
        element.resultCode;
        element.resultInfo;
        element.userID;
    });
}

results matching ""

    No results matching ""