I'm building a bot with the Microsoft Bot Framework, V3, in C# and trying to have the Dialog start and "welcome" the user with instructions before they enter any input. I would also like the Dialog to repeat every time that the user completes the form.
I'm attempting to use the FormFlow options: FormOptions.PromptInStart but it is still having the welcome message appear only after they enter some input. Not sure if this is deprecated with V1 or I'm just not doing it right. Any advice??
My classes are as below:
MessagesController:
internal static IDialog<MyClass> MakeRootDialog() { return Chain.From(() => FormDialog.FromForm(MyClass.BuildForm, options: FormOptions.PromptInStart)) .Do(async (context, order) => {//some actions here } }); } MyClass.cs :
[Serializable] public class MyClassDialog : IDialog<object> { public async Task StartAsync(IDialogContext context) { context.Wait(MessageReceivedAsync); } public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument) { var message = await argument; await context.PostAsync("You said: " + message.Text); context.Wait(MessageReceivedAsync); } } MyClassDialog.cs :
public class MyClass { public static IForm<MyClass> BuildForm() { OnCompletionAsyncDelegate<MyClass> processOrder = async (context, state) => { await context.PostAsync("We are currently filing your order....."); }; return new FormBuilder<MyClass>() .Message("Welcome to my bot!") //some actions here .Confirm(//more actions here) .AddRemainingFields() .Message("Thanks for providing your inputs") .OnCompletion(processOrder) .Build(); } };