同一個對話我試圖發送一條消息從機器人到模擬器上的用戶在同一個對話,但使用文檔中的代碼,它只創建一個新的對話,當我使用相同的對話ID時,它也創建了一個新對話,並且沒有回覆相同的對話。這段代碼創建一個新的對話發送消息到模擬器Bot Bot
var userAccount = new ChannelAccount(name: "User1", id: "@2c1c7fa3");
var botAccount = new ChannelAccount(name: "Conv1", id: "8a684db8");
var connector = new ConnectorClient(new Uri("http://localhost:9000/"));
var conversationId = await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount);
IMessageActivity message = Activity.CreateMessageActivity();
message.From = botAccount;
message.Recipient = userAccount;
message.Conversation = new ConversationAccount(id: conversationId.Id);
message.Text = "Hello";
message.Locale = "en-Us";
await connector.Conversations.SendToConversationAsync((Activity)message);
,如果我使用相同的對話id從用戶發送的消息,也創造了一個新的對話。這樣
IMessageActivity message = Activity.CreateMessageActivity();
message.From = botAccount;
message.Recipient = userAccount;
message.Conversation = new ConversationAccount(id: "Conv1");
message.Text = "Hello";
message.Locale = "en-Us";
await connector.Conversations.SendToConversationAsync((Activity)message);