sendChatroomRobotMessage method Null safety
Send a robot message in the chatroom.
Implementation
Future<NIMResult<NIMChatroomMessage>> sendChatroomRobotMessage({
required String roomId,
required String robotAccount,
required NIMRobotMessageType type,
String? text,
String? content,
String? target,
String? params,
bool resend = false,
ChatroomMessageAction? action,
}) async {
return _createMessage({
'roomId': roomId,
'robotAccount': robotAccount,
'robotMessageType': _robotMessageTypeMap[type],
'text': text,
'content': content,
'target': target,
'params': params,
'messageType': 'robot',
}).then((messageResult) async {
if (messageResult.isSuccess) {
final message = messageResult.data as NIMChatroomMessage;
await action?.call(message);
return sendChatroomMessage(message, resend);
} else {
return messageResult;
}
});
}