fix embed description text

This commit is contained in:
MapleLeaf
2021-12-27 13:49:38 -06:00
parent 91b6a15ed1
commit 32c1e02f92
2 changed files with 5 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import { omit } from "../../../helpers/omit"
import { ReacordElement } from "../../internal/element.js" import { ReacordElement } from "../../internal/element.js"
import type { MessageOptions } from "../../internal/message" import type { MessageOptions } from "../../internal/message"
import { Node } from "../../internal/node.js" import { Node } from "../../internal/node.js"
import { TextNode } from "../../internal/text-node"
import { EmbedChildNode } from "./embed-child.js" import { EmbedChildNode } from "./embed-child.js"
import type { EmbedOptions } from "./embed-options" import type { EmbedOptions } from "./embed-options"
@@ -43,6 +44,9 @@ class EmbedNode extends Node<EmbedProps> {
if (child instanceof EmbedChildNode) { if (child instanceof EmbedChildNode) {
child.modifyEmbedOptions(embed) child.modifyEmbedOptions(embed)
} }
if (child instanceof TextNode) {
embed.description = (embed.description || "") + child.props
}
} }
options.embeds.push(embed) options.embeds.push(embed)

View File

@@ -7,15 +7,9 @@ import {
EmbedImage, EmbedImage,
EmbedThumbnail, EmbedThumbnail,
EmbedTitle, EmbedTitle,
Reacord,
} from "../library/main" } from "../library/main"
import { TestAdapter, TestCommandInteraction } from "../library/testing"
import { setupReacordTesting } from "./setup-testing" import { setupReacordTesting } from "./setup-testing"
const adapter = new TestAdapter()
const reacord = new Reacord({ adapter })
const reply = reacord.createCommandReply(new TestCommandInteraction(adapter))
const { assertRender } = setupReacordTesting() const { assertRender } = setupReacordTesting()
test("kitchen sink", async () => { test("kitchen sink", async () => {
@@ -44,6 +38,7 @@ test("kitchen sink", async () => {
content: "", content: "",
embeds: [ embeds: [
{ {
description: "description text",
author: { author: {
icon_url: "https://example.com/author.png", icon_url: "https://example.com/author.png",
name: "author", name: "author",