@tryforge/forgescript
Version:
ForgeScript is a comprehensive package that empowers you to effortlessly interact with Discord's API. It ensures scripting remains easy to learn and consistently effective.
40 lines • 1.51 kB
JavaScript
;
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright © 2025 BotForge
*/
Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js");
const structures_1 = require("../../structures");
const components_1 = require("../../functions/components");
exports.default = new structures_1.NativeFunction({
name: "$addTextDisplay",
version: "2.4.0",
description: "Adds a new text display component",
unwrap: true,
brackets: true,
args: [
{
name: "content",
description: "The content of this text display",
rest: false,
required: true,
type: structures_1.ArgType.String,
},
],
execute(ctx, [content]) {
(0, components_1.addActionRow)(ctx);
const comp = ctx.container.components.at(-1);
const text = new discord_js_1.TextDisplayBuilder().setContent(content);
if (ctx.container.modal)
ctx.container.modal.addTextDisplayComponents(text);
else if (ctx.container.isInside(discord_js_1.ComponentType.Section))
ctx.component.section?.addTextDisplayComponents(text);
else if (comp instanceof discord_js_1.ContainerBuilder && ctx.container.isInside(discord_js_1.ComponentType.Container))
comp.addTextDisplayComponents(text);
else
ctx.container.components.push(text);
return this.success();
},
});
//# sourceMappingURL=addTextDisplay.js.map