Functiondiscord-component-embedv1.1.0
toComponentEmbed
Converts a Container tree into the JSON document Discord reads for a component embed. To write the JSON
into a page, use toComponentEmbedJson or toComponentEmbedScript. Both escape it for a <script> tag.
Throws:
A
ComponentEmbedErrorwhen the tree breaks a rule of the format.A
ComponentEmbedErrorwhen your own code throws while the package reads it. Checkerror.codeto tell the two apart.
toComponentEmbed(root: EmbedElement): ComponentEmbedPayloadroot
root: EmbedElement