是否可以使用 Bot Framework 更改 FormDialog 中退出突击队的关键字?
我想在键入某个单词时抛出 FormCanceledException (不使用英语作为语言)。
如果我可以更改关键字,或者添加另一个与退出相同的关键字,那就完美了
是的,这是可能的。一种方法是向FormCommand.Quit
命令。
Here你会发现一个例子正是这样做的(下面的代码供你参考)
private static IFormBuilder<T> CreateCustomForm<T>()
where T : class
{
var form = new FormBuilder<T>();
var command = form.Configuration.Commands[FormCommand.Quit];
var terms = command.Terms.ToList();
terms.Add("cancel");
command.Terms = terms.ToArray();
var templateAttribute = form.Configuration.Template(TemplateUsage.NotUnderstood);
var patterns = templateAttribute.Patterns;
patterns[0] += " Type *cancel* to quit or *help* if you want more information.";
templateAttribute.Patterns = patterns;
return form;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)