I have a simple child dialog call in my bot using IDialogContext.Call(). When user types "new project" the following code is called:
...
context.Call(new NewProjectDialog(), NewProjectConfirmed);
...
NewProjectDialog() just asks for a project name and then saves it before returning to NewProjectConfirmed()
[Serializable]
public class NewProjectDialog : IDialog<Project>
{
public async Task StartAsync(IDialogContext context)
{
await context.PostAsync("What is the name of the project?");
context.Wait(this.MessageReceivedAsync);
}
public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
var message = await result;
Project p = new Project();
//Saving project here...
await context.PostAsync($"OK. Your project '{message.Text}' was created.");
context.Done(p);
}
}
When the bot is called from emulator, Skype or Webchat everything works as expected. User asks for new project by typing "new project", bot asks for name, it WAITS and once project name entered by the user the bot confirms the new project creation.
But when I call the same from Slack, When the user ask for new project by typing "new project" the text "new project" is passed to the NewProjectDialog. it asks for the project name, but without waiting it passes "new project" further and saves it as the name for the project.
Not really sure what I am missing. Either iDialogContext.Wait() works differently with Slack or the Call() function seem to post the message to the child dialog like Forward() should.