sendChatroomCustomMessage method
- {required String roomId,
- NIMMessageAttachment? attachment,
- bool resend = false,
- ChatroomMessageAction? action}
发送聊天室自定义消息
Implementation
Future<NIMResult<NIMChatroomMessage>> sendChatroomCustomMessage({
required String roomId,
NIMMessageAttachment? attachment,
bool resend = false,
ChatroomMessageAction? action,
}) async {
return _createMessage({
'roomId': roomId,
'attachment': attachment?.toMap(),
'messageType': 'custom',
}).then((messageResult) async {
if (messageResult.isSuccess) {
final message = messageResult.data as NIMChatroomMessage;
await action?.call(message);
return sendChatroomMessage(message, resend);
} else {
return messageResult;
}
});
}