microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Samples/Samples.Echo/Program.cs
24lines · modecode
| 1 | using Microsoft.Teams.Apps.Activities; |
| 2 | using Microsoft.Teams.Apps.Extensions; |
| 3 | using Microsoft.Teams.Plugins.AspNetCore.DevTools.Extensions; |
| 4 | using Microsoft.Teams.Plugins.AspNetCore.Extensions; |
| 5 | |
| 6 | var builder = WebApplication.CreateBuilder(args); |
| 7 | builder.AddTeams().AddTeamsDevTools(); |
| 8 | var app = builder.Build(); |
| 9 | var teams = app.UseTeams(); |
| 10 | |
| 11 | teams.OnActivity(async (context, cancellationToken) => |
| 12 | { |
| 13 | context.Log.Info(context.AppId); |
| 14 | await context.Next(); |
| 15 | }); |
| 16 | |
| 17 | teams.OnMessage(async (context, cancellationToken) => |
| 18 | { |
| 19 | context.Log.Info("hit!"); |
| 20 | await context.Typing("processing your response", cancellationToken); |
| 21 | await context.Send($"you said '{context.Activity.Text}'", cancellationToken); |
| 22 | }); |
| 23 | |
| 24 | app.Run(); |