RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.
https://rocketchat.github.io/Rocket.Chat.Apps-engine/
MIT License
114 stars 119 forks source link

The getBlockBuilder method is deprecated #752

Open vorontsoved opened 3 months ago

vorontsoved commented 3 months ago

The getBlockBuilder method is deprecated, with which I can now build blocks and display it in a modal window

vorontsoved commented 3 months ago
export class MyApp extends App implements IUIKitInteractionHandler {
    public async executeActionButtonHandler(
        context: UIKitActionButtonInteractionContext,
        read: IRead,
        http: IHttp,
        persistence: IPersistence,
        modify: IModify
    ): Promise<IUIKitResponse> {
        const { 
            buttonContext, 
            actionId, 
            triggerId, 
            user, 
            room, 
            message,
        } = context.getInteractionData();

        // If you have multiple action buttons, use `actionId` to determine 
        // which one the user interacted with

        const blockBuilder = modify.getCreator().getBlockBuilder();

    return context.getInteractionResponder().openModalViewResponse({
        title: blockBuilder.newPlainTextObject('Interaction received'),
        blocks: blockBuilder.addSectionBlock({
            text: blockBuilder.newPlainTextObject('We received your interaction, thanks!')
        }).getBlocks(),
    });

        return context.getInteractionResponder().successResponse();
    }
}

how i can do it now