Reputation: 923
I'm currently busy designing a bot, that receives a project name and returns the status of it, however I can't get the prompting for the name to work.
Currently this is the method i'm using to prompt the user
[LuisIntent("ProjectInfo")]
public async Task projectInfo(IDialogContext context, LuisResult result, IAwaitable<string> Userresult)
{
await context.PostAsync($"Enter your project name");
var Promt = await Userresult;
string projectName = Promt.ToString().ToLower();
if(projectName != null)
{
TestInfo MI = new TestInfo();
if(MI.FindProject(projectName.ToString()) == 0)
{
await context.PostAsync($"Project Found. What do you want to know ?");
}
else
{
await context.PostAsync($"Project Not Found.");
}
}
context.Wait(MessageReceived);
}
With this current code I'm receiving a Exception: ProjectInfo [File of type 'text/plain'].
I have tried using a prompt dialog but that didn't seem to work ether. My end goal for this is to loop and prompt the user for a new project name until "Project Found" is displayed.
I'm not sure if I'm going about this the right way, if not any suggestions are welcome.
Upvotes: 0
Views: 383
Reputation: 132
Unfortunately I've not come across your version yet but I can give you an example of a different approach.
Usually I prompt for simple texts something like this:
PromptDialog.Text(context, AfterPromptMethod, "Prompt text", attempts: 100);
Signature of AfterPromptMethod:
async Task AfterPromptMethod(IDialogContext context, IAwaitable<string> userInput)
With this you could do your logic in the AfterPromptMethod and loop back to the prompt in messageReceived.
Upvotes: 1