microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v2.0.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Samples/Samples.BotBuilder/BotBuilderAdapter.cs

25lines · modeblame

dda763b0Kavin1 years ago1using Microsoft.Bot.Builder.Integration.AspNet.Core;
2using Microsoft.Bot.Builder.TraceExtensions;
3using Microsoft.Bot.Connector.Authentication;
4
5namespace Samples.BotBuilder
6{
7public class BotBuilderAdapter : CloudAdapter
8{
9public BotBuilderAdapter(BotFrameworkAuthentication auth, ILogger<IBotFrameworkHttpAdapter> logger)
10: base(auth, logger)
11{
12OnTurnError = async (turnContext, exception) =>
13{
14logger.LogError(exception, $"[OnTurnError] unhandled error : {exception.Message}");
15
16// Send a message to the user
17await turnContext.SendActivityAsync("The bot encountered an error or bug.");
18await turnContext.SendActivityAsync("To continue to run this bot, please fix the bot source code.");
19
20// Send a trace activity, which will be displayed in the Bot Framework Emulator
21await turnContext.TraceActivityAsync("OnTurnError Trace", exception.Message, "https://www.botframework.com/schemas/error", "TurnError");
22};
23}
24}
25}