T
Join ServerTyphonJS
typhonjs-runtime
How can I create an embeddedCollection in a chat message?
I have this:
But I think that might be creating a clone rather than updating the original message?
const messageDocument = game.messages.get(message._id);
const doc = new TJSDocument(messageDocument);
doc.embedded.create("Targets", targets);
But I think that might be creating a clone rather than updating the original message?
You can certainly learn more about how Foundry works itself. There are no embedded collections on chat messages as far as I know. Embedded collections in the core document model are set in advance. You can't just randomly add or create a new embedded collection on a document that is not configured to have any.
Create on the sense of reactive embedded collections "creates" the reactive binding, but a collection type must already exist on the document.
Create on the sense of reactive embedded collections "creates" the reactive binding, but a collection type must already exist on the document.