T

TyphonJS

typhonjs-runtime

Join Server

How can I create an embeddedCollection in a chat message?

Ggeoidesic5/8/2023
I have this:
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?
Mmleahy5/8/2023
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.