revert code
This commit is contained in:
@@ -2,7 +2,6 @@ import { CommandMessage } from "../../../core/types/commands";
|
||||
// @ts-ignore
|
||||
import { ComponentType, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, MessageFlags } from "discord.js";
|
||||
import { replaceVars, isValidUrlOrVariable, listVariables } from "../../../core/lib/vars";
|
||||
import { patchMessageWithDisplay } from "../../../core/api/discordAPI";
|
||||
|
||||
// Botones de edición (máx 5 por fila)
|
||||
const btns = (disabled = false) => ([
|
||||
@@ -105,9 +104,16 @@ const renderPreview = async (blockState: any, member: any, guild: any) => {
|
||||
return { type: 17, accent_color: blockState.color ?? null, components: previewComponents };
|
||||
};
|
||||
|
||||
// Helper para actualizar el editor vía REST y no filtrar display
|
||||
// Helper para actualizar el editor combinando Display Container dentro de components
|
||||
const updateEditor = async (msg: any, data: any) => {
|
||||
await patchMessageWithDisplay(msg.channelId, msg.id, data);
|
||||
const container = data?.display;
|
||||
const rows = Array.isArray(data?.components) ? data.components : [];
|
||||
const components = container ? [container, ...rows] : rows;
|
||||
const payload: any = { ...data };
|
||||
delete payload.display;
|
||||
payload.components = components;
|
||||
if (payload.flags === undefined) payload.flags = 32768; // según formato real en tu entorno
|
||||
await msg.edit(payload);
|
||||
};
|
||||
|
||||
export const command: CommandMessage = {
|
||||
@@ -159,7 +165,7 @@ export const command: CommandMessage = {
|
||||
// @ts-ignore
|
||||
await updateEditor(editorMessage, {
|
||||
content: null,
|
||||
flags: 4096,
|
||||
flags: 32768,
|
||||
display: await renderPreview(blockState, message.member, message.guild),
|
||||
components: btns(false)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user