reportMessage method

Future<void> reportMessage({
  1. required String messageId,
  2. required String tag,
  3. required String reason,
})

~english Reports an inappropriate message.

Param messageId The ID of the message to report.

Param tag The tag of the inappropriate message. You need to type a custom tag, like porn or ad.

Param reason The reporting reason. You need to type a specific reason.

Throws A description of the exception. See ChatError. ~end

~chinese 举报消息。

Param messageId 要举报的消息 ID。

Param tag 非法消息的标签。你需要填写自定义标签,例如涉政广告

Param reason 举报原因。你需要自行填写举报原因。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError。 ~end

Implementation

Future<void> reportMessage({
  required String messageId,
  required String tag,
  required String reason,
}) async {
  Map req = {"msgId": messageId, "tag": tag, "reason": reason};
  Map result =
      await ChatChannel.invokeMethod(ChatMethodKeys.reportMessage, req);
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}