split up embed file

This commit is contained in:
MapleLeaf
2021-12-25 04:06:56 -06:00
parent 6747f7bdaf
commit c74f8df231
6 changed files with 120 additions and 105 deletions

View File

@@ -0,0 +1,25 @@
import { MessageEmbedOptions } from "discord.js"
import React from "react"
import { ReacordElement } from "../element.jsx"
import { EmbedChildNode } from "./embed-child.js"
export type EmbedTitleProps = {
children: string
url?: string
}
export function EmbedTitle(props: EmbedTitleProps) {
return (
<ReacordElement
props={props}
createNode={() => new EmbedTitleNode(props)}
/>
)
}
class EmbedTitleNode extends EmbedChildNode<EmbedTitleProps> {
override modifyEmbedOptions(options: MessageEmbedOptions): void {
options.title = this.props.children
options.url = this.props.url
}
}