How to use the botbuilder-core.InputHints.AcceptingInput 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 / prompts / oauthPrompt.ts View on Github external
private async sendOAuthCardAsync(context: TurnContext, prompt?: string|Partial): Promise {
        // Validate adapter type
        if (!('getUserToken' in context.adapter)) {
            throw new Error(`OAuthPrompt.prompt(): not supported for the current adapter.`);
        }

        // Initialize outgoing message
        const msg: Partial =
            typeof prompt === 'object' ? {...prompt} : MessageFactory.text(prompt, undefined, InputHints.AcceptingInput);
        if (!Array.isArray(msg.attachments)) { msg.attachments = []; }

        // Add login card as needed
        if (this.channelSupportsOAuthCard(context.activity.channelId)) {
            const cards: Attachment[] = msg.attachments.filter((a: Attachment) => a.contentType === CardFactory.contentTypes.oauthCard);
            if (cards.length === 0) {
                let cardActionType = ActionTypes.Signin;
                let link: string;
                if (OAuthPrompt.isFromStreamingConnection(context.activity)) {
                    link = await (context.adapter as any).getSignInLink(context, this.settings.connectionName);
                } else {
                    // Retrieve the ClaimsIdentity from a BotFrameworkAdapter. For more information see
                    // https://github.com/microsoft/botbuilder-js/commit/b7932e37bb6e421985d5ce53edd9e82af6240a63#diff-3e3af334c0c6adf4906ee5e2a23beaebR250
                    const identity = context.turnState.get((context.adapter as any).BotIdentityKey);
                    if (identity && isSkillClaim(identity.claims)) {
                        // Force magic code for Skills (to be addressed in R8)
github microsoft / botbuilder-js / libraries / botbuilder-dialogs / src / prompts / oauthPrompt.ts View on Github external
public async beginDialog(dc: DialogContext, options?: PromptOptions): Promise {
        // Ensure prompts have input hint set
        const o: Partial = {...options};
        if (o.prompt && typeof o.prompt === 'object' && typeof o.prompt.inputHint !== 'string') {
            o.prompt.inputHint = InputHints.AcceptingInput;
        }
        if (o.retryPrompt && typeof o.retryPrompt === 'object' && typeof o.retryPrompt.inputHint !== 'string') {
            o.retryPrompt.inputHint = InputHints.AcceptingInput;
        }

        // Initialize prompt state
        const timeout: number = typeof this.settings.timeout === 'number' ? this.settings.timeout : 900000;
        const state: OAuthPromptState = dc.activeDialog.state as OAuthPromptState;
        state.state = {};
        state.options = o;
        state.expires = new Date().getTime() + timeout;

        // Attempt to get the users token
        const output: TokenResponse = await this.getUserToken(dc.context);
        if (output !== undefined) {
            // Return token
            return await dc.endDialog(output);
        } else {
            // Prompt user to login
github microsoft / botbuilder-js / libraries / botbuilder-dialogs-adaptive / src / activityProperty.ts View on Github external
}

    public set speak(value: string) {
        this._speak = value;
        if (typeof value === 'string') {
            this._speakTemplate = stringTemplate.compile(value);
        } else {
            this._speakTemplate = undefined;
        }
    }

    public get speak(): string {
        return this._speak;
    }

    public inputHint: InputHints = InputHints.AcceptingInput;

    public hasValue(override?: Partial|string): boolean {
        return !!(override || this._value);
    }

    public format(dc: DialogContext, extraData?: object, override?: Partial|string): Partial {
        // Format basic activity
        let activity: Partial;
        if (override) {
            activity = this.formatOverride(override, dc);
        } else if (typeof this._value === 'string') {
            activity = {
                type: ActivityTypes.Message,
                text: this._textTemplate(dc)
            }
        } else if (typeof this._value === 'object') {