当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript CardAction.imBack方法代码示例

本文整理汇总了TypeScript中botbuilder.CardAction.imBack方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CardAction.imBack方法的具体用法?TypeScript CardAction.imBack怎么用?TypeScript CardAction.imBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botbuilder.CardAction的用法示例。


在下文中一共展示了CardAction.imBack方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: step1

    private static async step1(session: builder.Session, args?: any | builder.IDialogResult<any>, next?: (args?: builder.IDialogResult<any>) => void): Promise<void> {
        let cards = new Array<builder.ThumbnailCard>();
        let numbCards = 3;

        for (let i = 0; i < numbCards; i++) {
            let buttons = new Array<builder.CardAction>();
            /**
             * This is an example of a button using invoke to begin a new dialog
             * the response field is used as a way to pass data to the newly begun dialog
             * the response field is not needed
             *
             * This is an example of getting the input data from the args
             * when dialog is begun with beginDialog()
             */
            // let input = "";
            // if (args.response) {
            //     input = args.response;
            // }
            buttons.push(new builder.CardAction(session)
                .type("invoke")
                .title(Strings.invoke_button_hello_dialog)
                .value("{" +
                    "\"dialog\": \"" + DialogIds.HelloDialogId + "\", " +
                    "\"response\": \"Information for called intent\"" +
                "}"),
            );

            buttons.push(builder.CardAction.imBack(session, session.gettext(Strings.hello_imback), Strings.imback_button_hello_dialog));

            let messageBackButtonValue = JSON.stringify({ anything: "abc12345" });
            let messageBackButton = builder.CardAction.messageBack(session, messageBackButtonValue, Strings.messageBack_button_title)
                .displayText(Strings.messageBack_button_display_text)
                .text(Strings.messageBack_button_text); // this matches match for MessageBackReceiverDialog
            buttons.push(messageBackButton);

            let newCard = new builder.ThumbnailCard(session)
                .title(Strings.default_title)
                .subtitle(Strings.default_subtitle)
                .text(Strings.default_text)
                .images([
                    new builder.CardImage(session)
                        .url(config.get("app.baseUri") + "/assets/computer_person.jpg")
                        .alt(session.gettext(Strings.img_default)),
                ])
                .buttons(buttons)
                .tap(builder.CardAction.imBack(session, session.gettext(Strings.hello_imback)));

            cards.push(newCard);
        }

        session.send(new builder.Message(session)
            // .attachmentLayout("list")
            .attachmentLayout("carousel")
            .attachments(cards));

        session.endDialog();
    }
开发者ID:gvprime,项目名称:microsoft-teams-sample-complete-node,代码行数:57,代码来源:ThumbnailCardDialog.ts

示例2: getSuggestedActions

function getSuggestedActions(session: Session): SuggestedActions {
    const yes = session.localizer.gettext(session.preferredLocale(), 'confirmation.yesOption');
    const no = session.localizer.gettext(session.preferredLocale(), 'confirmation.noOption');
    const cancel = session.localizer.gettext(session.preferredLocale(), 'confirmation.cancelOption');
    return SuggestedActions.create(session, [
        CardAction.imBack(session, yes, yes),
        CardAction.imBack(session, no, no),
        CardAction.imBack(session, cancel, cancel)]);
}
开发者ID:magencio,项目名称:UberBotNode_V3,代码行数:9,代码来源:confirmationPrompt.ts

示例3: getSuggestedActions

function getSuggestedActions(session: Session): SuggestedActions {
    const faq = session.localizer.gettext(session.preferredLocale(), 'master.faqOption');
    const feedback = session.localizer.gettext(session.preferredLocale(), 'master.feedbackOption');
    const complaints = session.localizer.gettext(session.preferredLocale(), 'master.complaintsOption');
    const language = session.localizer.gettext(session.preferredLocale(), 'master.languageOption');
    return SuggestedActions.create(session, [
        CardAction.imBack(session, faq, faq),
        CardAction.imBack(session, feedback, feedback),
        CardAction.imBack(session, complaints, complaints),
        CardAction.imBack(session, language, language)]);
}
开发者ID:magencio,项目名称:UberBotNode_V3,代码行数:11,代码来源:masterDialog.ts

示例4: promptForIdentityProvider

 // Prompt the user to pick an identity provider
 private promptForIdentityProvider(session: builder.Session): void {
     let msg = new builder.Message(session)
         .addAttachment(new builder.ThumbnailCard(session)
             .title("Select an identity provider")
             .buttons([
                 builder.CardAction.imBack(session, "LinkedIn", "LinkedIn"),
                 builder.CardAction.messageBack(session, "{}", "AzureAD (v1)")
                     .displayText("AzureAD (v1)")
                     .text("AzureADv1"),
                 builder.CardAction.imBack(session, "Google", "Google"),
             ]));
     session.send(msg);
 }
开发者ID:billbliss,项目名称:microsoft-teams-sample-auth-node,代码行数:14,代码来源:RootDialog.ts

示例5:

 (session: any, results: any) => {
     session.send('I am looking for the nearest store to ' + results.response + ', please wait a few seconds');
     session.send('Oh and based on what you need I can also recommand that you get a Office 365 subscription, are you interested in this?');
     var msg = new builder.Message(session)
             .textFormat(builder.TextFormat.xml)
             .attachmentLayout(builder.AttachmentLayout.carousel)
             .attachments([
                 new builder.HeroCard(session)
                     .title("Special Offer")
                     .text("Add an Office 365 subscription?")
                     .images([])
                     .buttons([
                         builder.CardAction.imBack(session, "Yes", "Yes"),
                         builder.CardAction.imBack(session, "No", "No")
                     ])
             ]);
         builder.Prompts.choice(session, msg, "Yes|No");
 },
开发者ID:DXFrance,项目名称:botretail,代码行数:18,代码来源:retailbot.dialogsManager.ts

示例6: step1

    private static async step1(session: builder.Session, args?: any | builder.IDialogResult<any>, next?: (args?: builder.IDialogResult<any>) => void): Promise<void> {
        let buttons = new Array<builder.CardAction>();
        buttons.push(builder.CardAction.imBack(session, "y_e_s", session.gettext(Strings.game_button_yes) + "3"));
        buttons.push(builder.CardAction.imBack(session, "n_o", session.gettext(Strings.game_button_no) + "3"));

        let newCard = new builder.HeroCard(session)
            .title(session.gettext(Strings.default_title) + "3")
            .subtitle(Strings.default_subtitle)
            .text(Strings.quiz_choose)
            .images([
                new builder.CardImage(session)
                    .url(config.get("app.baseUri") + "/assets/computer_person.jpg")
                    .alt(session.gettext(Strings.img_default)),
            ])
            .buttons(buttons);

        let msg = new builder.Message(session)
            .addAttachment(newCard);

        builder.Prompts.choice(session, msg, ["y_e_s", "n_o"]);
    }
开发者ID:gvprime,项目名称:microsoft-teams-sample-complete-node,代码行数:21,代码来源:QuizQ3Dialog.ts

示例7: getCardsAttachments

export function getCardsAttachments(session: builder.Session) {
    return [
        new builder.HeroCard(session)
            .title(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_title_findplace', "greetings"))
            .subtitle(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_subtitletitle_findplace', "greetings"))
            .buttons([
                builder.CardAction.imBack(session, "Find a medical location", "Select")
            ]),

        new builder.HeroCard(session)
            .title(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_title_medication'), "greetings")
            .subtitle(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_subtitletitle_medication'), "greetings")
            .buttons([
                builder.CardAction.imBack(session, "I need details about a medication", "Select")
            ]),

        new builder.HeroCard(session)
            .title(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_title_translation'), "greetings")
            .subtitle(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_subtitletitle_translation'), "greetings")
            .buttons([
                builder.CardAction.imBack(session, "Translate a medication", "Select")
            ])
    ];
}
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:24,代码来源:greetings-dialog.ts

示例8: request

                (session: any, results: any) => {
                    session.send('Ok!');
                    session.send('Here is the nearest store I have found. A seller will be able to answer your questions. :)');
                    var address = "3 bis, rue rottembourg 75012 PARIS" //results.response;
                    var res = request('GET', 'http://dev.virtualearth.net/REST/v1/Locations?countryRegion=FR&key=AsiCMSmOq6O3MzsI4F7HqUXmB2JY7E76gdaCgtlranURBYOHgbariAXQxJURoTE8&addressLine=' + address);
                    var bing = JSON.parse(res.getBody('utf8'));
                    if (bing.resourceSets[0].estimatedTotal) {
                        let lat = bing.resourceSets[0].resources[0].point.coordinates[0];
                        let lng = bing.resourceSets[0].resources[0].point.coordinates[1];
                        this._store = [Number.MAX_SAFE_INTEGER, null];
                        for (let i = 0, len = this._stores.length; i < len; i++) {
                            let distance = this._geolocalisation.getDistanceFromLatLonInKm(lat, lng, this._stores[i].localisation.lat, this._stores[i].localisation.lng)
                            if (distance < this._store[0]) {
                                this._store[0] = distance;
                                this._store[1] = this._stores[i];
                            }
                        }

                        var msg = new builder.Message(session)
                            .textFormat(builder.TextFormat.xml)
                            .attachmentLayout(builder.AttachmentLayout.carousel)
                            .attachments([
                                new builder.HeroCard(session)
                                    .title(this._store[1].name)
                                    .text("12 Rue Halévy, 75009 Paris")
                                    .images([
                                        builder.CardImage.create(session, "http://www.timstanleyphoto.com/HDR/2012/i-GrS2b37/0/L/MicrosoftStore-L.jpg")
                                            .tap(builder.CardAction.showImage(session, "http://www.timstanleyphoto.com/HDR/2012/i-GrS2b37/0/L/MicrosoftStore-L.jpg")),
                                    ])
                                    .buttons([
                                        builder.CardAction.openUrl(session, "http://bing.com/maps/default.aspx?rtp=adr." + "39%20quai%20du%20president%20roosevelt%2092130%20issy%20les%20moulineaux" + "~adr." + "12 Rue Halévy, 75009 Paris" + "&rtop=0~1~0", "Bing Direction"),
                                        builder.CardAction.imBack(session, "Let's go !", "Go")
                                    ])
                            ]);
                        builder.Prompts.choice(session, msg, "Let's go !");

                    } else {
                        session.send('I cannot find a store near you, try with a different address');
                    }
                },
开发者ID:DXFrance,项目名称:botretail,代码行数:40,代码来源:retailbot.dialogsManager.ts

示例9: getSuggestedActions

function getSuggestedActions (library: Library, session: Session): SuggestedActions {
    const finish = session.localizer.gettext(session.preferredLocale(), 'faq.finishOption', library.name);
    return SuggestedActions.create(session, [
        CardAction.imBack(session, finish, finish)]);
}
开发者ID:magencio,项目名称:UberBotNode_V3,代码行数:5,代码来源:faqDialog.ts


注:本文中的botbuilder.CardAction.imBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。