wingbot 3.42.0 → 3.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Processor.js +1 -0
- package/src/Responder.js +15 -4
package/package.json
CHANGED
package/src/Processor.js
CHANGED
package/src/Responder.js
CHANGED
|
@@ -63,6 +63,12 @@ Object.freeze(ExpectedInput);
|
|
|
63
63
|
* @prop {string} [voice]
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* @callback VoiceControlFactory
|
|
68
|
+
* @param {object} state
|
|
69
|
+
* @returns {VoiceControl}
|
|
70
|
+
*/
|
|
71
|
+
|
|
66
72
|
/** @typedef {import('./ReturnSender').UploadResult} UploadResult */
|
|
67
73
|
|
|
68
74
|
/**
|
|
@@ -91,6 +97,7 @@ class Responder {
|
|
|
91
97
|
this._bookmark = null;
|
|
92
98
|
|
|
93
99
|
this.options = {
|
|
100
|
+
state: Object.freeze({}),
|
|
94
101
|
translator: (w) => w,
|
|
95
102
|
appUrl: ''
|
|
96
103
|
};
|
|
@@ -149,9 +156,9 @@ class Responder {
|
|
|
149
156
|
this.startedOutput = false;
|
|
150
157
|
|
|
151
158
|
/**
|
|
152
|
-
* @type {VoiceControl}
|
|
159
|
+
* @type {VoiceControl|VoiceControlFactory}
|
|
153
160
|
*/
|
|
154
|
-
this.voiceControl =
|
|
161
|
+
this.voiceControl = null;
|
|
155
162
|
|
|
156
163
|
this._trackAsAction = null;
|
|
157
164
|
|
|
@@ -477,11 +484,15 @@ class Responder {
|
|
|
477
484
|
}
|
|
478
485
|
|
|
479
486
|
if (this._features.includes(FEATURE_VOICE)
|
|
480
|
-
&& (voice ||
|
|
487
|
+
&& (voice || this.voiceControl)) {
|
|
481
488
|
|
|
482
489
|
Object.assign(messageData.message, {
|
|
483
490
|
voice: {
|
|
484
|
-
...this.voiceControl
|
|
491
|
+
...(typeof this.voiceControl === 'function'
|
|
492
|
+
? this.voiceControl(Object.freeze({
|
|
493
|
+
...this.options.state, ...this.newState
|
|
494
|
+
}))
|
|
495
|
+
: this.voiceControl),
|
|
485
496
|
...voice
|
|
486
497
|
}
|
|
487
498
|
});
|