@builderbot/bot 1.4.2-alpha.12 → 1.4.2-alpha.13

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/dist/index.cjs CHANGED
@@ -15088,31 +15088,34 @@ const formats$1 = {
15088
15088
  code: 'libmp3lame',
15089
15089
  ext: 'mp3',
15090
15090
  },
15091
- opus: {
15091
+ ogg: {
15092
15092
  code: 'libopus',
15093
- ext: 'opus',
15093
+ ext: 'ogg',
15094
15094
  },
15095
15095
  mp4: {
15096
15096
  code: 'aac',
15097
15097
  ext: 'mp4',
15098
15098
  },
15099
15099
  };
15100
- const convertAudio = async (filePath, format = 'opus') => {
15100
+ const convertAudio = async (filePath, format = 'ogg') => {
15101
15101
  if (!filePath) {
15102
15102
  throw new Error('filePath is required');
15103
15103
  }
15104
- const opusFilePath = path.join(path.dirname(filePath), `${path.basename(filePath, path.extname(filePath))}.${formats$1[format].ext}`);
15104
+ const outputFilePath = path.join(path.dirname(filePath), `${path.basename(filePath, path.extname(filePath))}.${formats$1[format].ext}`);
15105
15105
  await new Promise((resolve, reject) => {
15106
- ffmpeg(filePath)
15106
+ const cmd = ffmpeg(filePath)
15107
15107
  .audioCodec(formats$1[format].code)
15108
- .audioBitrate('64k')
15108
+ .audioBitrate(format === 'ogg' ? '32k' : '64k')
15109
15109
  .format(formats$1[format].ext)
15110
- .output(opusFilePath)
15110
+ .output(outputFilePath)
15111
15111
  .on('end', () => resolve())
15112
- .on('error', (err) => reject(err))
15113
- .run();
15112
+ .on('error', (err) => reject(err));
15113
+ if (format === 'ogg') {
15114
+ cmd.audioChannels(1).audioFrequency(48000).outputOptions(['-application voip', '-frame_duration 20']);
15115
+ }
15116
+ cmd.run();
15114
15117
  });
15115
- return opusFilePath;
15118
+ return outputFilePath;
15116
15119
  };
15117
15120
 
15118
15121
  /**
@@ -1,6 +1,6 @@
1
1
  export interface FormatOptions {
2
2
  code: string;
3
- ext: 'mp4' | 'opus' | 'mp3';
3
+ ext: 'mp4' | 'ogg' | 'mp3';
4
4
  }
5
5
  declare const convertAudio: (filePath: string, format?: FormatOptions["ext"]) => Promise<string>;
6
6
  export { convertAudio };
@@ -1 +1 @@
1
- {"version":3,"file":"convertAudio.d.ts","sourceRoot":"","sources":["../../src/utils/convertAudio.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;CAC9B;AAiBD,QAAA,MAAM,YAAY,GAAU,UAAU,MAAM,EAAE,SAAQ,aAAa,CAAC,KAAK,CAAU,KAAG,OAAO,CAAC,MAAM,CAqBnG,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"convertAudio.d.ts","sourceRoot":"","sources":["../../src/utils/convertAudio.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;CAC7B;AAiBD,QAAA,MAAM,YAAY,GAAU,UAAU,MAAM,EAAE,SAAQ,aAAa,CAAC,KAAK,CAAS,KAAG,OAAO,CAAC,MAAM,CA0BlG,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/bot",
3
- "version": "1.4.2-alpha.12",
3
+ "version": "1.4.2-alpha.13",
4
4
  "description": "core typescript",
5
5
  "author": "Leifer Mendez <leifer33@gmail.com>",
6
6
  "homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
@@ -62,5 +62,5 @@
62
62
  "optionalDependencies": {
63
63
  "sharp": "0.33.3"
64
64
  },
65
- "gitHead": "82ab82fdd7ced0525855ba36709a87249b6184e5"
65
+ "gitHead": "f86750f3faca18e6b11fad07d818ddf8c57bf6e7"
66
66
  }