utilitas 1999.1.7 → 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/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.length <= OPENAI_TTS_MAX_LENGTH
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 (text, options) => {
433
+ ctx.speech = async (cnt, options) => {
435
434
  let file;
436
- if (Buffer.isBuffer(text)) {
437
- file = await convert(text, { input: BUFFER, expected: FILE });
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
- text, { expected: 'file' }
439
+ cnt, { expected: 'file' }
441
440
  ), logOptions);
442
441
  }
443
442
  if (!file) { return; }
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.7",
4
+ "version": "1999.1.8",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.7",
4
+ "version": "1999.1.8",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",