@builderbot/provider-baileys 1.2.8 → 1.2.10-alpha.0
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/bailey.d.ts +5 -0
- package/dist/bailey.d.ts.map +1 -1
- package/dist/index.cjs +72 -10
- package/package.json +4 -4
package/dist/bailey.d.ts
CHANGED
|
@@ -10,9 +10,14 @@ import type { BaileyGlobalVendorArgs } from './type';
|
|
|
10
10
|
declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
11
11
|
globalVendorArgs: BaileyGlobalVendorArgs;
|
|
12
12
|
msgRetryCounterCache?: NodeCache;
|
|
13
|
+
userDevicesCache?: NodeCache;
|
|
14
|
+
private logger;
|
|
15
|
+
private logStream;
|
|
13
16
|
private idsDuplicates;
|
|
14
17
|
private mapSet;
|
|
15
18
|
constructor(args: Partial<BaileyGlobalVendorArgs>);
|
|
19
|
+
private setupCleanupHandlers;
|
|
20
|
+
private cleanup;
|
|
16
21
|
releaseSessionFiles(): Promise<void>;
|
|
17
22
|
protected beforeHttpServerInit(): void;
|
|
18
23
|
protected afterHttpServerInit(): void;
|
package/dist/bailey.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bailey.d.ts","sourceRoot":"","sources":["../src/bailey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAA;AAI9C,OAAO,SAAS,MAAM,YAAY,CAAA;AAIlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,OAAO,EAGH,eAAe,EAEf,SAAS,EACT,QAAQ,EASR,KAAK,EAER,MAAM,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,WAAW,GAAU,UAAU,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,WAAW,KAAG,OAAO,CAAC,GAAG,CAAC,CAM3F;IAED;;;;;;OAMG;IAEH,YAAY,GAAU,WAAW,MAAM,EAAE,UAAU,GAAG,EAAE,WAAW,GAAG,EAAE,WAAU,GAAU;;OAa3F;IAED;;;;;;;OAOG;IAEH,WAAW,GACP,WAAW,GAAG,EACd,eAAe;QAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,EAClE,aAAa,MAAM,EACnB,SAAS,MAAM,EACf,WAAU,GAAU;;OAyBvB;IAED;;;;OAIG;IACH,kBAAkB,GAAU,WAAW,GAAG,EAAE,YAAY,GAAG,mBAE1D;IAED;;;;;;OAMG;IAEH,WAAW,GACP,WAAW,GAAG,EACd,KAAK,MAAM,GAAG,MAAM,EACpB,gBAAgB,OAAO,CAAC,eAAe,CAAC,EACxC,WAAU,GAAU,mBAWvB;IAED,OAAO,CAAC,WAAW,CAYlB;IAED,OAAO,CAAC,gBAAgB,CAAmE;IAE3F;;;;;OAKG;IACH,QAAQ,GAAU,KAAK,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,UAAU;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,MAAM,CAAC,CAUnG;CACJ;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -30936,9 +30936,6 @@ const releaseTmp = async (sessionName, ms) => {
|
|
|
30936
30936
|
return idTimer;
|
|
30937
30937
|
};
|
|
30938
30938
|
|
|
30939
|
-
const logger = new console$1.Console({
|
|
30940
|
-
stdout: require$$0$5.createWriteStream(`${process.cwd()}/baileys.log`),
|
|
30941
|
-
});
|
|
30942
30939
|
class BaileysProvider extends bot.ProviderClass {
|
|
30943
30940
|
constructor(args) {
|
|
30944
30941
|
super();
|
|
@@ -30946,7 +30943,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30946
30943
|
name: `bot`,
|
|
30947
30944
|
gifPlayback: false,
|
|
30948
30945
|
usePairingCode: false,
|
|
30949
|
-
browser: ['Windows', '
|
|
30946
|
+
browser: ['Windows', 'Chrome', 'Chrome 114.0.5735.198'],
|
|
30950
30947
|
phoneNumber: null,
|
|
30951
30948
|
useBaileysStore: true,
|
|
30952
30949
|
port: 3000,
|
|
@@ -31005,13 +31002,13 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31005
31002
|
}
|
|
31006
31003
|
}
|
|
31007
31004
|
catch (e) {
|
|
31008
|
-
logger.log(e);
|
|
31005
|
+
this.logger.log(e);
|
|
31009
31006
|
this.initVendor().then((v) => this.listenOnEvents(v));
|
|
31010
31007
|
}
|
|
31011
31008
|
try {
|
|
31012
31009
|
const sock = makeWASocketOther({
|
|
31013
31010
|
logger: loggerBaileys,
|
|
31014
|
-
version: [2, 3000,
|
|
31011
|
+
version: [2, 3000, 1023223821],
|
|
31015
31012
|
printQRInTerminal: false,
|
|
31016
31013
|
auth: {
|
|
31017
31014
|
creds: state.creds,
|
|
@@ -31117,7 +31114,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31117
31114
|
return sock.ev;
|
|
31118
31115
|
}
|
|
31119
31116
|
catch (e) {
|
|
31120
|
-
logger.log(e);
|
|
31117
|
+
this.logger.log(e);
|
|
31121
31118
|
this.emit('auth_failure', [
|
|
31122
31119
|
`Something unexpected has occurred, do not panic`,
|
|
31123
31120
|
`Restart the BOT`,
|
|
@@ -31147,7 +31144,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31147
31144
|
await this.vendor.sendMessage(jid, { text: this.globalVendorArgs.experimentalSyncMessage });
|
|
31148
31145
|
}
|
|
31149
31146
|
catch (e) {
|
|
31150
|
-
logger.log(e);
|
|
31147
|
+
this.logger.log(e);
|
|
31151
31148
|
}
|
|
31152
31149
|
}
|
|
31153
31150
|
};
|
|
@@ -31274,7 +31271,6 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31274
31271
|
messageCtx.update.pollUpdates.length === 0) {
|
|
31275
31272
|
continue;
|
|
31276
31273
|
}
|
|
31277
|
-
messageCtx?.update?.pollUpdates[0]?.pollUpdateMessageKey;
|
|
31278
31274
|
const payload = {
|
|
31279
31275
|
...messageCtx,
|
|
31280
31276
|
body: pollMessage.find((poll) => poll.voters.length > 0)?.name || '',
|
|
@@ -31564,8 +31560,74 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31564
31560
|
await promises.writeFile(pathFile, buffer);
|
|
31565
31561
|
return require$$1$1.resolve(pathFile);
|
|
31566
31562
|
};
|
|
31567
|
-
this.
|
|
31563
|
+
this.logStream = require$$0$5.createWriteStream(`${process.cwd()}/baileys.log`, {
|
|
31564
|
+
flags: 'a',
|
|
31565
|
+
autoClose: true,
|
|
31566
|
+
emitClose: true
|
|
31567
|
+
});
|
|
31568
|
+
this.logger = new console$1.Console({
|
|
31569
|
+
stdout: this.logStream,
|
|
31570
|
+
stderr: this.logStream
|
|
31571
|
+
});
|
|
31572
|
+
this.msgRetryCounterCache = new NodeCache({
|
|
31573
|
+
stdTTL: 1800, // 30 minutos (más tiempo para reintentos)
|
|
31574
|
+
checkperiod: 300, // Limpieza cada 5 minutos (menos frecuente)
|
|
31575
|
+
maxKeys: 50000, // 50K entradas (más espacio)
|
|
31576
|
+
deleteOnExpire: true,
|
|
31577
|
+
useClones: false,
|
|
31578
|
+
forceString: false,
|
|
31579
|
+
errorOnMissing: false
|
|
31580
|
+
});
|
|
31581
|
+
this.userDevicesCache = new NodeCache({
|
|
31582
|
+
stdTTL: 7200, // 2 horas (dispositivos cambian poco)
|
|
31583
|
+
checkperiod: 600, // Limpieza cada 10 minutos
|
|
31584
|
+
maxKeys: 5000, // Más dispositivos
|
|
31585
|
+
deleteOnExpire: true,
|
|
31586
|
+
useClones: false,
|
|
31587
|
+
forceString: false,
|
|
31588
|
+
errorOnMissing: false
|
|
31589
|
+
});
|
|
31568
31590
|
this.globalVendorArgs = { ...this.globalVendorArgs, ...args };
|
|
31591
|
+
this.setupCleanupHandlers();
|
|
31592
|
+
}
|
|
31593
|
+
setupCleanupHandlers() {
|
|
31594
|
+
const cleanup = () => {
|
|
31595
|
+
this.logger.log(`[${new Date().toISOString()}] Iniciando limpieza de recursos...`);
|
|
31596
|
+
this.cleanup();
|
|
31597
|
+
};
|
|
31598
|
+
process.on('SIGINT', cleanup);
|
|
31599
|
+
process.on('SIGTERM', cleanup);
|
|
31600
|
+
process.on('SIGUSR1', cleanup);
|
|
31601
|
+
process.on('SIGUSR2', cleanup);
|
|
31602
|
+
process.on('uncaughtException', (error) => {
|
|
31603
|
+
this.logger.log(`[${new Date().toISOString()}] Uncaught Exception:`, error);
|
|
31604
|
+
this.cleanup();
|
|
31605
|
+
process.exit(1);
|
|
31606
|
+
});
|
|
31607
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
31608
|
+
this.logger.log(`[${new Date().toISOString()}] Unhandled Rejection at:`, promise, 'reason:', reason);
|
|
31609
|
+
});
|
|
31610
|
+
}
|
|
31611
|
+
cleanup() {
|
|
31612
|
+
try {
|
|
31613
|
+
if (this.msgRetryCounterCache) {
|
|
31614
|
+
this.msgRetryCounterCache.close();
|
|
31615
|
+
this.msgRetryCounterCache = undefined;
|
|
31616
|
+
}
|
|
31617
|
+
if (this.userDevicesCache) {
|
|
31618
|
+
this.userDevicesCache.close();
|
|
31619
|
+
this.userDevicesCache = undefined;
|
|
31620
|
+
}
|
|
31621
|
+
this.mapSet.clear();
|
|
31622
|
+
this.idsDuplicates.length = 0;
|
|
31623
|
+
if (this.logStream && typeof this.logStream.end === 'function') {
|
|
31624
|
+
this.logStream.end();
|
|
31625
|
+
}
|
|
31626
|
+
this.logger.log(`[${new Date().toISOString()}] Recursos limpiados correctamente`);
|
|
31627
|
+
}
|
|
31628
|
+
catch (error) {
|
|
31629
|
+
console.error('Error durante cleanup:', error);
|
|
31630
|
+
}
|
|
31569
31631
|
}
|
|
31570
31632
|
async releaseSessionFiles() {
|
|
31571
31633
|
const NAME_DIR_SESSION = `${this.globalVendorArgs.name}_sessions`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/provider-baileys",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10-alpha.0",
|
|
4
4
|
"description": "Now I'm the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin' letters to relatives / Embellishin' my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Leifer Mendez <leifer33@gmail.com>",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@builderbot/bot": "^1.2.
|
|
33
|
+
"@builderbot/bot": "^1.2.10-alpha.0",
|
|
34
34
|
"@hapi/boom": "^10.0.1",
|
|
35
35
|
"@jest/globals": "^29.7.0",
|
|
36
36
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
62
62
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
63
63
|
"@types/polka": "^0.5.7",
|
|
64
|
-
"baileys": "~6.7.
|
|
64
|
+
"baileys": "~6.7.17",
|
|
65
65
|
"fluent-ffmpeg": "^2.1.2",
|
|
66
66
|
"fs-extra": "^11.2.0",
|
|
67
67
|
"node-cache": "^5.1.2"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "24ee1e15176ed4ad251a6b2aef8866fccb35c71e"
|
|
70
70
|
}
|