utilitas 1999.1.6 → 1999.1.8
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/README.md +4 -7
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +227 -302
- package/lib/bot.mjs +6 -7
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/bot.mjs
CHANGED
|
@@ -370,8 +370,7 @@ const subconscious = [{
|
|
|
370
370
|
ctx.shouldSpeech = async text => {
|
|
371
371
|
text = isSet(text, true) ? (text || '') : ctx.tts;
|
|
372
372
|
const should = ctx._.speech?.tts && ctx.checkSpeech();
|
|
373
|
-
should && text && text
|
|
374
|
-
&& await ctx.speech(text);
|
|
373
|
+
should && text && await ctx.speech(text);
|
|
375
374
|
return should;
|
|
376
375
|
};
|
|
377
376
|
ctx.collect = (content, type, options) => type ? ctx.collected.push(
|
|
@@ -431,13 +430,13 @@ const subconscious = [{
|
|
|
431
430
|
}, getExtra(ctx, options)));
|
|
432
431
|
ctx.audio = async (sr, op) => await ctx.media('replyWithAudio', sr, op);
|
|
433
432
|
ctx.image = async (sr, op) => await ctx.media('replyWithPhoto', sr, op);
|
|
434
|
-
ctx.speech = async (
|
|
433
|
+
ctx.speech = async (cnt, options) => {
|
|
435
434
|
let file;
|
|
436
|
-
if (Buffer.isBuffer(
|
|
437
|
-
file = await convert(
|
|
438
|
-
} else {
|
|
435
|
+
if (Buffer.isBuffer(cnt)) {
|
|
436
|
+
file = await convert(cnt, { input: BUFFER, expected: FILE });
|
|
437
|
+
} else if (cnt.length <= OPENAI_TTS_MAX_LENGTH) {
|
|
439
438
|
file = await ignoreErrFunc(async () => await ctx._.speech.tts(
|
|
440
|
-
|
|
439
|
+
cnt, { expected: 'file' }
|
|
441
440
|
), logOptions);
|
|
442
441
|
}
|
|
443
442
|
if (!file) { return; }
|
package/lib/manifest.mjs
CHANGED