// greeting message
        private async Task SendGreetingMessage(Activity message)
        {
            using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
            {
                // only set the speak if it suports it.
                var channelCapability = new ChannelCapability(Address.FromActivity(message));
                var reply             = message.CreateReply();

                var client = scope.Resolve <IConnectorClient>();
                try
                {
                    // send a welcome message to the user
                    reply.Text = "Welcome to the Taxi Reservation Bot! I can answer questions about our service and schedule ride reservations.";
                }
                catch (Exception e)
                {
                    // if an error occured add the error text as the message
                    reply.Text = e.Message;
                }
                if (channelCapability.SupportsSpeak())
                {
                    reply.Speak     = reply.Text;
                    reply.InputHint = InputHints.ExpectingInput;
                }
                await client.Conversations.ReplyToActivityAsync(reply);
            }
        }
        public IMessageActivity Map(IMessageActivity message)
        {
            // only set the speak if it is not set by the developer.
            var channelCapability = new ChannelCapability(Address.FromActivity(message));

            if (channelCapability.SupportsSpeak() && string.IsNullOrEmpty(message.Speak))
            {
                message.Speak = message.Text;
            }

            return(message);
        }
Example #3
0
        public IMessageActivity Map(IMessageActivity message)
        {
            // only set the speak if it is not set by the developer.
            var channelCapability = new ChannelCapability(Address.FromActivity(message));

            if (channelCapability.SupportsSpeak() && string.IsNullOrEmpty(message.Speak))
            {
                var isQuestion = SetSpeech(message);

                // set InputHint to ExpectingInput if text is a question
                if (isQuestion)
                {
                    message.InputHint = InputHints.ExpectingInput;
                }
                else
                {
                    message.InputHint = InputHints.AcceptingInput;
                }
            }

            return(message);
        }