Router Masterbot Tools
This module provides Wingbot Processor
plugins extending the Wingbot core
functionality. In the project such plugin is initialized in the following way:
const { Processor } = require('wingbot');
const { PLUGIN_CLASS } = require('router-masterbot-tools');
const processor = new Processor(...);
processor.plugin(new PLUGIN_CLASS());
SharedContextPlugin
The purpose of this plugin is to simplify handling of a shared context in
a multi bot environment. The plugin ensures the following functionality:
-
The shared context sent by the router in the pass_thread_control event is
available in req.sharedContext
and it is also stored in the conversation state.
-
Adds the method setSharedContext(data: Object)
to the Responder
object.
This method enables to inform the router about the shared context update. The
method also updates the local copy of the shared context in the conversation
state. The shared context is not overwritten but merged.
-
Overrides Responder.trackAsSkill()
to store the skill not only in the
conversation state but also in the shared context. Additionally, it saves appId
in shared context every time a skill is stored.