TIMMsgSetGroupReceiveMessageOpt
Introduction
Set group receiving message option
Set group receiving message option, you may check on GroupBaseInfo.
Any group member can call the MsgSetGroupReceiveMessageOpt API to modify the group message receiving option. Available group message receiving options are as follows:
TIMReceiveMessageOpt.kTIMRecvMsgOpt_Receive: messages will be received when the user is online, and push notifications will be received when the user is offline.
TIMReceiveMessageOpt.kTIMRecvMsgOpt_Not_Receive: no group messages will be received.
TIMReceiveMessageOpt.kTIMRecvMsgOpt_Not_Notify: messages will be received when the user is online, and no push notification will be received when the user is offline.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgSetGroupReceiveMessageOptParams | MsgSetGroupReceiveMessageOptParams | yes | Param of setting group receiving message option |
Returned template
Promise<commonResult<string>>
{
code: TIMResult | TIMErrCode;
desc?: string | undefined;
json_param?: string | undefined;
json_params?: string | undefined;
user_data?: string | undefined;
}
Return value details
name | type | description |
---|---|---|
code | TIMResult | TIMErrCode | Request result: Error codes. 0 means success. |
desc | string | undefined | The description of the error. It will be empty if success. |
json_param | string | undefined | Return value of calling API |
json_params | string | undefined | Return value of calling API. Compatible field, which is returned in some cases. |
user_data | string | undefined | ImSDK is responsible for transporting user-defined data without any processing |
Code example
import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { MsgSetGroupReceiveMessageOptParams } from "im_electron_sdk/dist/interfaces";
let groupId = ''
let opt = 0
let param: MsgSetGroupReceiveMessageOptParams = {
group_id: '',
opt: opt,
user_data: ''
}
const { code } = await timRenderInstance.TIMMsgSetGroupReceiveMessageOpt(param);
if (code == 0) {
// success
}