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