This would be fairly easy to accomplish with temporary storage Like a dictionary. There would be a number of ways to accomplish this. One thing I would look into is scorables for catching the "No" text. In this example I did not use scorables But it does the basic functionality you are looking for. The idea is that when a message comes in, you check to see if you have already saved a message from that userId and saved it, if not save it. If the user sends the text "No" save the text to permanent storage and remove the entry from the dictionary. I am just doing this in a basic RootDialog.cs:
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
{
var activity = await result as Activity;
var userId = activity.From.Id;
var message = activity.Text;
if (!Utils.FirstMessageDictionary.ContainsKey(userId))
{
Utils.FirstMessageDictionary.Add(userId, message);
await context.PostAsync($"Message saved {userId} - {Utils.FirstMessageDictionary[userId]}");
}
if (message.ToLower() == "no")
{
//save to permanent storage here
Utils.FirstMessageDictionary.Remove(userId);
await context.PostAsync($"Entry Removed for {userId}");
try
{
await context.PostAsync($"{userId} - {Utils.FirstMessageDictionary[userId]}");
}
catch (Exception e)
{
await context.PostAsync($"No entry found for {userId}");
}
}
context.Wait(MessageReceivedAsync);
}
I also made this simple class for the dictionary:
public static class Utils
{
public static Dictionary<string, string> FirstMessageDictionary = new Dictionary<string, string>();
}