Hello everyone! I have a task when clicking on the button “button_1” to remove buttons from the open modal window and fill it with new buttons. My code with the current modal window and buttons is below. How can I achieve the result? I did not find something similar in the documentation Rocket.Chat Developer
import {
IAppAccessors,
IConfigurationExtend,
ILogger,
IRead,
IModify
} from '@rocket.chat/apps-engine/definition/accessors';
import { App } from '@rocket.chat/apps-engine/definition/App';
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
import { ISlashCommand, SlashCommandContext } from "@rocket.chat/apps-engine/definition/slashcommands";
import { UIKitSurfaceType } from "@rocket.chat/apps-engine/definition/uikit";
export class CyApp extends App {
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
super(info, logger, accessors);
}
protected async extendConfiguration(configuration: IConfigurationExtend): Promise<void> {
await configuration.slashCommands.provideSlashCommand(new OpenModalCommand(this));
}
}
class OpenModalCommand implements ISlashCommand {
public command = 'score';
public i18nParamsExample = 'slashcommand_params';
public i18nDescription = 'slashcommand_description';
public providesPreview = false;
constructor(private readonly app: App) {}
public async executor(
context: SlashCommandContext,
_read: IRead,
modify: IModify
): Promise<void> {
const block = modify.getCreator().getBlockBuilder();
block.addSectionBlock({
blockId: 'section_1',
text: block.newPlainTextObject('Нажми на интересующий вопрос', true),
});
const space_3 = '\u2800\u2800\u2800';
const space_4 = '\u2800\u2800\u2800\u2800';
const space_5 = '\u2800\u2800\u2800\u2800\u2800';
const space_7 = '\u2800\u2800\u2800\u2800\u2800\u2800\u2800';
const space_8 = '\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800';
block.addActionsBlock({
blockId: 'buttons_block',
elements: [
block.newButtonElement({
actionId: 'button_1',
text: block.newPlainTextObject(`${space_5}Text 1${space_5}`),
value: 'btn1',
style: undefined,
}),
block.newButtonElement({
actionId: 'button_2',
text: block.newPlainTextObject(`${space_5}Text 2${space_5}`),
value: 'btn2',
style: undefined,
}),
block.newButtonElement({
actionId: 'button_3',
text: block.newPlainTextObject(`${space_4}Text 3${space_4}`),
value: 'btn3',
style: undefined,
url: 'https:
}),
],
});
block.addActionsBlock({
blockId: 'buttons_block',
elements: [
block.newButtonElement({
actionId: 'button_4',
text: block.newPlainTextObject(`${space_7}Text 4${space_8}`),
value: 'btn4',
style: undefined,
}),
block.newButtonElement({
actionId: 'button_5',
text: block.newPlainTextObject(`${space_3}Text 5${space_4}`),
value: 'btn5',
style: undefined,
url: 'https:
}),
block.newButtonElement({
actionId: 'button_6',
text: block.newPlainTextObject(`${space_7}Text 6${space_8}`),
value: 'btn6',
style: undefined,
url: 'https:
}),
],
});
await modify.getUiController().openSurfaceView(
{
id: 'modal-id',
type: UIKitSurfaceType.MODAL,
title: {
text: 'SCORE',
type: 'plain_text'
},
blocks: block.getBlocks(),
},
{ triggerId: context.getTriggerId()! },
context.getSender()
);
}
}
=