embed: exclude children from embed options

This commit is contained in:
MapleLeaf
2021-12-26 11:54:58 -06:00
parent 6909336cac
commit bfeb28eeb1

View File

@@ -1,5 +1,6 @@
import React from "react" import React from "react"
import { ReacordElement } from "../element.js" import { ReacordElement } from "../element.js"
import { omit } from "../helpers/omit"
import type { MessageOptions } from "../message" import type { MessageOptions } from "../message"
import { Node } from "../node.js" import { Node } from "../node.js"
import { EmbedChildNode } from "./embed-child.js" import { EmbedChildNode } from "./embed-child.js"
@@ -37,7 +38,7 @@ export function Embed(props: EmbedProps) {
class EmbedNode extends Node<EmbedProps> { class EmbedNode extends Node<EmbedProps> {
override modifyMessageOptions(options: MessageOptions): void { override modifyMessageOptions(options: MessageOptions): void {
const embed = { ...this.props } const embed = omit(this.props, ["children"])
for (const child of this.children) { for (const child of this.children) {
if (child instanceof EmbedChildNode) { if (child instanceof EmbedChildNode) {
child.modifyEmbedOptions(embed) child.modifyEmbedOptions(embed)