https://docs.botframework.com/en-us/support/upgrade-to-v3/#navtitle
マイクロソフト人民は、以下のリンクを参照して、独自のボットを開発するためのサンプルを提供V3にV1から、あなたのボットを更新するために、以下のドキュメントを参照してくださいエコーボット、砂の魔女ボットのようないくつかのサンプルが含まれていますそしてピザボットなど。 V1ボットと同様https://github.com/Microsoft/BotBuilder/tree/master/CSharp/Samples
、V3ボット
0以下のようなアクティビティタイプを有します
あなたは活動タイプの詳細情報が必要な場合は、HandleSystemMessage(アクティビティメッセージ)メソッドのリンク
https://docs.botframework.com/en-us/csharp/builder/sdkreference/activities.html
サンプルコード以下、これを参照してください。
private async Task<Activity> HandleSystemMessage(Activity message)
{
if (message.Type == ActivityTypes.DeleteUserData)
{
// Implement user deletion here
// If we handle user deletion, return a real message
}
else if (message.Type == ActivityTypes.ConversationUpdate)
{
// Handle conversation state changes, like members being added and removed
// Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info
// Not available in all channels
IConversationUpdateActivity conversationupdate = message;
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
{
var client = scope.Resolve<IConnectorClient>();
if (conversationupdate.MembersAdded.Any())
{
var reply = message.CreateReply();
foreach (var newMember in conversationupdate.MembersAdded)
{
if (newMember.Id != message.Recipient.Id)
{
reply.Text = $"Welcome {newMember.Name}! ";
}
else
{
reply.Text = $"Welcome {message.From.Name}";
}
await client.Conversations.ReplyToActivityAsync(message);
}
}
}
}
else if (message.Type == ActivityTypes.ContactRelationUpdate)
{
// Handle add/remove from contact lists
// Activity.From + Activity.Action represent what happened
IContactRelationUpdateActivity update = message;
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
{
var client = scope.Resolve<IConnectorClient>();
if (update.Action.ToLower() == "add")
{
var reply = message.CreateReply();
reply.Text = $"Welcome to the XXXX bot! To start an conversation with this bot send **XXXX** or **XXXX** command.\r \n if you need help, send the **Help** command.";
await client.Conversations.ReplyToActivityAsync(reply);
}
}
}
else if (message.Type == ActivityTypes.Typing)
{
// Handle knowing tha the user is typing
}
else if (message.Type == ActivityTypes.Ping)
{
}
return null;
}
を受け入れて、それはあなたに助け
-Kishore
なぜこの答えがわからないことを願っています。このコードを貼り付けるときに名前空間について追加できるのはちょっとしたことだけをデフォルトのテンプレートに追加する必要があります。 Autofacを使うのが好きです。 Microsoft.Bot.Builder.Dialogsを使用しています。 System.Linqを使用します。私のためにその作品をありがとう。 – rahularyansharma