wingbot 3.41.3 → 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 +20 -1
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
|
};
|
|
@@ -148,6 +155,11 @@ class Responder {
|
|
|
148
155
|
*/
|
|
149
156
|
this.startedOutput = false;
|
|
150
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @type {VoiceControl|VoiceControlFactory}
|
|
160
|
+
*/
|
|
161
|
+
this.voiceControl = null;
|
|
162
|
+
|
|
151
163
|
this._trackAsAction = null;
|
|
152
164
|
|
|
153
165
|
// both vars are package protected
|
|
@@ -471,9 +483,16 @@ class Responder {
|
|
|
471
483
|
}
|
|
472
484
|
}
|
|
473
485
|
|
|
474
|
-
if (
|
|
486
|
+
if (this._features.includes(FEATURE_VOICE)
|
|
487
|
+
&& (voice || this.voiceControl)) {
|
|
488
|
+
|
|
475
489
|
Object.assign(messageData.message, {
|
|
476
490
|
voice: {
|
|
491
|
+
...(typeof this.voiceControl === 'function'
|
|
492
|
+
? this.voiceControl(Object.freeze({
|
|
493
|
+
...this.options.state, ...this.newState
|
|
494
|
+
}))
|
|
495
|
+
: this.voiceControl),
|
|
477
496
|
...voice
|
|
478
497
|
}
|
|
479
498
|
});
|