如何将来自用户的消息存储在变量中? (微软机器人框架)

How can i store a message from the user in a variable? (Microsoft Bot Framework)

我正在为基于 MS Bot Framework 的机器人开发反馈功能。因此我想使用 Azure Table 存储来存储反馈。除一点外一切正常:

目前,当用户向机器人发送反馈时,table-插入过程开始。但是,我的占位符“moin”没有插入来自用户的消息,而是插入到 table 存储中。

// Schlüssel für den Table-Zugriff
                string accountKey = "myKey";
                string accountName = "myStorageAccountName";

                // Schlüssel werden hier für den Table-Eintrag zusammengepackt
                TableQueries tableQueries = new TableQueries
                {
                    accountKey = accountKey,
                    accountName = accountName
                };

                // Werte für den Table-Eintrag
                string rowKey = "1";
                string partitionKey = rowKey;
                string userStatement = "moin";

                // Methode für den Table-Eintrag wird hier ausgeführt
                Task<Boolean> bLinkCreated = tableQueries.InsertURL(partitionKey, rowKey, userStatement);
                bLinkCreated.Wait();

                // Wird ausgeführt, wenn keine KnowledgeBase gefunden wird
                System.Diagnostics.Debug.WriteLine("sending feedback");
                await turnContext.SendActivityAsync(MessageFactory.Text("Thanks for sending the feedback!"), cancellationToken);
                break;

如何用用户发送的消息替换我当前的占位符? 是否有 method/function 提取用户消息,然后用我的 userStatement 变量替换它?

假设您的回合上下文是 ITurnContext<IMessageActivity> turnContext。然后你可以在 turnContext.Activity.Text

中找到消息
string userStatement = turnContext.Activity.Text;