chat.addToBlacklist(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
userIDList | Array | List of userID values of the users to be added to the blocklist. The number of userID values cannot exceed 1,000 per request. |
Promise
let promise = chat.addToBlacklist({userIDList: ['user1', 'user2']});promise.then(function(imResponse) {console.log(imResponse.data);console.warn('addToBlacklist error:', imError); // Failed to add the user to the blocklist});
chat.removeFromBlacklist(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
userIDList | Array | List of userID values of the users to be removed from the blocklist. The number of userID values cannot exceed 1,000 per request. |
Promise
let promise = chat.removeFromBlacklist({userIDList: ['user1', 'user2']});console.log(imResponse.data);console.warn('removeFromBlacklist error:', imError); // Failed to remove the user from the blocklist});
TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED
event.chat.getBlacklist();
Promise
let promise = chat.getBlacklist();promise.then(function(imResponse) {console.log(imResponse.data);}).catch(function(imError) {console.warn('getBlacklist error:', imError); // Failed to obtain the blocklist});
let onBlacklistUpdated = function(event) {console.log(event.data);};chat.on(TencentCloudChat.EVENT.BLACKLIST_UPDATED, onBlacklistUpdated);
Was this page helpful?