createTextAtMessage

Introduction

Create a group @ message.

The sender listens for the characters in the input box. When the sender enters @, the group member selection UI will pop up. After the target group members are selected, the message will be displayed in the input box in the format of "@A @B @C......", which can be further edited before sent.

In the group chat list of the receiver's conversation UI, the identifier "someone@me" or "@all" will be displayed to remind the user that the user was mentioned by someone in the group chat.

For details, you can referring to this document.

Parameter details

Parameter name Parameter type Required Platform Description
text String yes All The text of the message.
atUserList List< String > yes All The constant value __kImSDK_MesssageAtALL__ can be speficied to the atUserList, to mention all members (@all) in the group, shows in the following example codes.

Returned template

V2TimValueCallback<V2TimMsgCreateInfoResult>

{
    code: int,
    desc: String,
    data: {
        id: String,
        messageInfo: V2TimMessage,
    }
}

Return value details

name type description
code int Request result: Error codes. 0 means success.
desc String The description of the failure.
data V2TimMsgCreateInfoResult The group at message created.

Code example

    V2TimValueCallback<V2TimMsgCreateInfoResult> createTextAtMessageRes =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .createTextAtMessage(
      text: "test", 
      atUserList: ['__kImSDK_MesssageAtALL__', 'uesr1'], 
    );
    if (createTextAtMessageRes.code == 0) {
      String? id = createTextAtMessageRes.data?.id;
      V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
          .v2TIMManager
          .getMessageManager()
          .sendMessage(id: id!, receiver: "", groupID: "groupID");
      if (sendMessageRes.code == 0) {
      }
    }

results matching ""

    No results matching ""