microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
next/oauth-card-null-ref-bug

Branches

Tags

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

Clone

HTTPS

Download ZIP

core/samples/AllFeatures/Program.cs

28lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using Microsoft.Teams.Bot.Apps;
5using Microsoft.Teams.Bot.Apps.Schema;
6using Microsoft.Teams.Bot.Apps.Schema.Entities;
7
8var builder = TeamsBotApplication.CreateBuilder();
9var teamsApp = builder.Build();
10
11teamsApp.OnMessage = async (messageArgs, context, cancellationToken) =>
12{
13 string replyText = $"You sent: `{messageArgs.Text}` in activity of type `{context.Activity.Type}`.";
14
15 await context.SendTypingActivityAsync(cancellationToken);
16
17 TeamsActivity reply = TeamsActivity.CreateBuilder()
18 .WithType(TeamsActivityType.Message)
19 .WithConversationReference(context.Activity)
20 .WithText(replyText)
21 .Build();
22
23 reply.AddMention(context.Activity.From!, "ridobotlocal", true);
24
25 await context.TeamsBotApplication.SendActivityAsync(reply, cancellationToken);
26};
27
28teamsApp.Run();
29