1
votes

Is there a simple way I can have a user message in Microsoft Bot Framework passed into a string variable (c#)?

Essentially, I want to take the next user message as an input half way through a method and continue the execution of the same method with the message stored as a variable.

I want to avoid the process of using PromptDialog, modifying the enclosing method to fit the PromptDialog parameters (since my method will have LuisResult and not IAwaitable...), etc.

What I want is the equivalent of taking user inputs through the console, but in this case I would be doing it through the bot framework interface - without exiting or modifying the method I'm in currently. Nothing fancy is needed, like retries, etc.

EDIT: I don't want/need the message to go through LUIS either (MessageReceived also puts each message through LUIS)

Thanks!

1

1 Answers

0
votes

There is no way of currently doing it. Bots have to be stateless all the state of the bot must be explicitly maintained in IBotDataBag. What you are hoping to do will essentially create an anonymous method that references local variables. The resulting closure is not serializable.