isRobotMessage static method

bool isRobotMessage(
  1. V2TimMessage message
)

Implementation

static bool isRobotMessage(V2TimMessage message) {
  bool res = false;
  if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM &&
      message.customElem != null &&
      message.customElem!.data != null) {
    var data = message.customElem!.data!;
    try {
      var jsonData = json.decode(data);
      var isChatbotPlugin = jsonData["chatbotPlugin"] ?? "";
      if (isChatbotPlugin.toString() == "1") {
        res = true;
      }
    } catch (err) {
      //err
    }
  }
  return res;
}