Пример #1
0
        protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            if (turnContext.Activity.Attachments != null)
            {
                var url         = turnContext.Activity.Attachments[0].ContentUrl;
                var transcribed = await SpeechRecognizer.RecognizeSpeechAsync(url);

                if (transcribed != "")
                {
                    await turnContext.SendActivityAsync("You said: " + transcribed);
                }
                turnContext.Activity.Text = transcribed;
            }
            else
            {
                await turnContext.SendActivityAsync("I can understand voice messages, try me.");
            }
        }