TIMMsgModifyMessage

Introduction

Modify message

If success, self and peer (C2C) or group member (Group) will receive TIMMsgUpdateCallbackFunc.

Success or fail, cb will return the modified message

If the message is modified during modificaion, cb will return error ERR_SDK_MSG_MODIFY_CONFLICT.

When modifying messages, the IM SDK restricts the conversation participants to modify them. If you need more restrictions, such as the restrictions that can only be modified by the message sender, you can handle them at the business layer.

Parameter details

Parameter name Parameter type Required Description
msgModifyMessageParams MsgModifyMessageParams yes Param of modifying message

Returned template

Promise<commonResult<Json_value_msg>>

{
    code: TIMResult | TIMErrCode;
    desc?: string | undefined;
    json_param?: Json_value_msg | undefined;
    json_params?: Json_value_msg | undefined; 
    user_data?: string | undefined;
}

Return value details

name type description
code TIMResultTIMErrCode Request result: Error codes. 0 means success.
desc string | undefined The description of the error. It will be empty if success.
json_param Json_value_msg | undefined Return value of calling API
json_params Json_value_msg | 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 { MsgModifyMessageParams } from "im_electron_sdk/dist/interfaces";
let { code1, json_params } = await timRenderInstance.TIMMsgGetMsgList(null);
if (code1 == 0) {
    let message1 = json_params[0];
    let modifyMessage = ''
    message1.message_elem_array[0].text_elem_content = modifyMessage;
    let param: MsgModifyMessageParams = {
        params: message1,
        user_data: ''
    }

    const { code } = await timRenderInstance.TIMMsgModifyMessage(param)
    if (code == 0) {
        // success
    }
}

results matching ""

    No results matching ""