beginnings: rendering text to message

This commit is contained in:
MapleLeaf
2021-12-08 14:12:26 -06:00
parent c0aa4ee108
commit 57d55fe58f
17 changed files with 516 additions and 27 deletions

16
src/render.ts Normal file
View File

@@ -0,0 +1,16 @@
import type { TextBasedChannels } from "discord.js"
import { ReacordContainer } from "./container"
import { reconciler } from "./reconciler"
export type ReacordRenderTarget = TextBasedChannels
export function render(content: string, target: ReacordRenderTarget) {
const container = new ReacordContainer(target)
const containerId = reconciler.createContainer(container, 0, false, null)
reconciler.updateContainer(content, containerId)
return {
destroy: () => {
reconciler.updateContainer(null, containerId)
},
}
}