microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
core/samples/CompatBot/MyCompatMiddleware.cs
20lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Bot.Builder; |
| 5 | |
| 6 | namespace CompatBot |
| 7 | { |
| 8 | public class MyCompatMiddleware : Microsoft.Bot.Builder.IMiddleware |
| 9 | { |
| 10 | public async Task OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken = default) |
| 11 | { |
| 12 | Console.WriteLine("MyCompatMiddleware: OnTurnAsync"); |
| 13 | Console.WriteLine(turnContext.Activity.Text); |
| 14 | |
| 15 | await turnContext.SendActivityAsync(MessageFactory.Text("Hello from MyCompatMiddleware!"), cancellationToken); |
| 16 | |
| 17 | await next(cancellationToken).ConfigureAwait(false); |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |