wingbot 3.53.0 → 3.53.1-alpha.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/resolvers/message.js +11 -0
package/package.json
CHANGED
package/src/resolvers/message.js
CHANGED
|
@@ -192,6 +192,12 @@ function selectTranslation (resolverId, params, texts, data) {
|
|
|
192
192
|
const key = `_R_${resolverId}`;
|
|
193
193
|
let { lang, [key]: seqState } = data;
|
|
194
194
|
|
|
195
|
+
if (texts.length === 0) {
|
|
196
|
+
console.log('MSG0-P', params); // eslint-disable-line no-console
|
|
197
|
+
console.log('MSG0-D', { resolverId, texts }); // eslint-disable-line no-console
|
|
198
|
+
throw new Error(`Resolver ${resolverId} failed ${JSON.stringify(params.text).replace(/"([^"]+)":/g, '$1:')}`);
|
|
199
|
+
}
|
|
200
|
+
|
|
195
201
|
if (texts.length === 1) {
|
|
196
202
|
return [
|
|
197
203
|
renderMessageText(texts[0].t, data),
|
|
@@ -220,6 +226,11 @@ function selectTranslation (resolverId, params, texts, data) {
|
|
|
220
226
|
const index = data._expandRandomTexts
|
|
221
227
|
? 1
|
|
222
228
|
: Math.floor(Math.random() * texts.length);
|
|
229
|
+
if (!texts[index]) {
|
|
230
|
+
console.log('MSG-P', params); // eslint-disable-line no-console
|
|
231
|
+
console.log('MSG-D', { resolverId, texts }); // eslint-disable-line no-console
|
|
232
|
+
throw new Error(`Resolver ${resolverId} failed ${JSON.stringify(params.text).replace(/"([^"]+)":/g, '$1:')}`);
|
|
233
|
+
}
|
|
223
234
|
return [
|
|
224
235
|
renderMessageText(texts[index].t, data),
|
|
225
236
|
seqState
|