Reputation: 1631
I have read somewhere that we can use IScorable.cs
to implement globally available commands e.g. type "settings" anywhere in chat flow to open settings dialog. But there seems to be no documentation on how to use it.
Please help.
Upvotes: 1
Views: 858
Reputation: 14787
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" (a.k.a. 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.
Upvotes: 5