How to use the botbuilder-core.MessageFactory.text function in botbuilder-core

To help you get started, we’ve selected a few botbuilder-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-js / libraries / botbuilder-dialogs / src / choices / choiceFactory.ts View on Github external
let txt: string = (text || '');
        txt += ' ';
        ChoiceFactory.toChoices(choices).forEach((choice: any, index: number) => {
            const title: string = choice.action && choice.action.title ? choice.action.title : choice.value;
            // tslint:disable-next-line:prefer-template
            txt += `${ connector }${ opt.includeNumbers ? '(' + (index + 1).toString() + ') ' : '' }${ title }`;
            if (index === (choices.length - 2)) {
                connector = (index === 0 ? opt.inlineOr : opt.inlineOrMore) || '';
            } else {
                connector = opt.inlineSeparator || '';
            }
        });
        txt += '';

        // Return activity with choices as an inline list.
        return MessageFactory.text(txt, speak, InputHints.ExpectingInput);
    }
github microsoft / botbuilder-js / libraries / botbuilder-dialogs / src / choices / choiceFactory.ts View on Github external
...options
        } as ChoiceFactoryOptions;

        // Format list of choices
        let connector = '';
        let txt: string = (text || '');
        txt += '\n\n   ';
        ChoiceFactory.toChoices(choices).forEach((choice: any, index: number) => {
            const title: string = choice.action && choice.action.title ? choice.action.title : choice.value;
            // tslint:disable-next-line:prefer-template
            txt += `${ connector }${ opt.includeNumbers ? (index + 1).toString() + '. ' : '- ' }${ title }`;
            connector = '\n   ';
        });

        // Return activity with choices as a numbered list.
        return MessageFactory.text(txt, speak, InputHints.ExpectingInput);
    }
github microsoft / botbuilder-js / libraries / botbuilder-lg / src / activityFactory.ts View on Github external
private static buildActivityFromText(text: string): Partial {
        return MessageFactory.text(text, text);
    }