I have read somewhere that we can use IScorable.cs
to implement globally available commands eg type "settings" anywhere in chat flow to open settings dialog. But there seems to be no documentation on how to use it.
Please help.
You are right, implementing IScorable.cs
is the way to go if you want to have global commands in BotFramework.
Having an IScorable it's basically a two steps procedure:
BotFramework will go through all the IScorables
first to see if any of them "wins" (aka if they will be doing something or not) and if no one handle the message; then it will continue dispatching the message to the dialogs.
Regarding how to write your IScorable
, the best thing is to look into some examples:
Regarding how to register the IScorable
, I would recommend you doing something like the following in the Global.asax.cs
, Application_Start
method:
var builder = new ContainerBuilder();
builder.RegisterType<SettingsScorable>()
.As<IScorable<IActivity, double>>()
.InstancePerLifetimeScope();
builder.Update(Conversation.Container);
That shows how the SettingsScorable
of the ContosoFlowers is being registered in the Autofac
container.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.