@builderbot/provider-baileys 1.3.1 → 1.3.2-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 +8 -0
- package/dist/bailey.d.ts.map +1 -1
- package/dist/index.cjs +38 -1
- package/dist/index.mjs +38 -1
- package/package.json +4 -4
package/dist/bailey.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { PathOrFileDescriptor } from 'fs';
|
|
|
4
4
|
import NodeCache from 'node-cache';
|
|
5
5
|
import type polka from 'polka';
|
|
6
6
|
import type { IStickerOptions } from 'wa-sticker-formatter';
|
|
7
|
+
|
|
7
8
|
import { BaileysEventMap, WAMessage, WASocket, proto } from './baileyWrapper';
|
|
8
9
|
import type { BaileyGlobalVendorArgs } from './type';
|
|
9
10
|
declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
@@ -17,6 +18,7 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
17
18
|
private logStream;
|
|
18
19
|
private idsDuplicates;
|
|
19
20
|
private mapSet;
|
|
21
|
+
private readonly PROBLEMATIC_USERS;
|
|
20
22
|
constructor(args: Partial<BaileyGlobalVendorArgs>);
|
|
21
23
|
/**
|
|
22
24
|
* Setup cleanup handlers
|
|
@@ -50,6 +52,12 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
50
52
|
flush(): boolean;
|
|
51
53
|
isBuffering(): boolean;
|
|
52
54
|
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Manejo específico de errores Bad MAC para usuarios problemáticos
|
|
57
|
+
* @param messageCtx Contexto del mensaje con error
|
|
58
|
+
* @returns true si se manejó el usuario problemático, false si no
|
|
59
|
+
*/
|
|
60
|
+
private handleBadMACForProblematicUser;
|
|
53
61
|
/**
|
|
54
62
|
* Map native events that the Provider class expects
|
|
55
63
|
* to have a standard set of events
|
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;AAIjF,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,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAGpD,cAAM,eAAgB,SAAQ,aAAa,CAAC,QAAQ,CAAC;IAC1C,gBAAgB,EAAE,sBAAsB,CAgB9C;IAED,OAAO,CAAC,iBAAiB,CAAI;IAC7B,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,cAAc,CAAO;IAE7B,oBAAoB,CAAC,EAAE,SAAS,CAAA;IAChC,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAE5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAuB;IAExC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,MAAM,CAAY;
|
|
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;AAIjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAA;AAI9C,OAAO,SAAS,MAAM,YAAY,CAAA;AAIlC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MG;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;IAED,OAAO,CAAC,eAAe;YAmBT,gBAAgB;CA8BjC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -30959,6 +30959,8 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30959
30959
|
this.reconnectDelay = 1000; // 1 segundo inicial
|
|
30960
30960
|
this.idsDuplicates = [];
|
|
30961
30961
|
this.mapSet = new Set();
|
|
30962
|
+
// ✅ Configuración escalable para usuarios problemáticos
|
|
30963
|
+
this.PROBLEMATIC_USERS = new Set(['@lid']);
|
|
30962
30964
|
this.indexHome = (req, res) => {
|
|
30963
30965
|
try {
|
|
30964
30966
|
const botName = req[this.idBotName];
|
|
@@ -31181,8 +31183,11 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31181
31183
|
messageCtx.messageStubParameters[0].includes('No session'))
|
|
31182
31184
|
continue;
|
|
31183
31185
|
if (messageCtx?.messageStubParameters?.length &&
|
|
31184
|
-
messageCtx.messageStubParameters[0].includes('Bad MAC'))
|
|
31186
|
+
messageCtx.messageStubParameters[0].includes('Bad MAC')) {
|
|
31187
|
+
// Manejo específico para usuarios problemáticos
|
|
31188
|
+
this.handleBadMACForProblematicUser(messageCtx);
|
|
31185
31189
|
continue;
|
|
31190
|
+
}
|
|
31186
31191
|
if (messageCtx?.messageStubParameters?.length &&
|
|
31187
31192
|
messageCtx.messageStubParameters[0].includes('Invalid')) {
|
|
31188
31193
|
if (this.globalVendorArgs.fallBackAction) {
|
|
@@ -31734,6 +31739,38 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31734
31739
|
.get('/', this.indexHome);
|
|
31735
31740
|
}
|
|
31736
31741
|
afterHttpServerInit() { }
|
|
31742
|
+
/**
|
|
31743
|
+
* Manejo específico de errores Bad MAC para usuarios problemáticos
|
|
31744
|
+
* @param messageCtx Contexto del mensaje con error
|
|
31745
|
+
* @returns true si se manejó el usuario problemático, false si no
|
|
31746
|
+
*/
|
|
31747
|
+
handleBadMACForProblematicUser(messageCtx) {
|
|
31748
|
+
const userId = messageCtx?.key?.remoteJid;
|
|
31749
|
+
if (!userId)
|
|
31750
|
+
return false;
|
|
31751
|
+
// Verificación rápida y eficiente
|
|
31752
|
+
const isProblematic = Array.from(this.PROBLEMATIC_USERS).some(user => userId.includes(user));
|
|
31753
|
+
if (isProblematic) {
|
|
31754
|
+
this.logger.log(`🔧 [${new Date().toISOString()}] Bad MAC en usuario problemático: ${userId}`);
|
|
31755
|
+
// Cleanup eficiente y no-bloqueante
|
|
31756
|
+
setImmediate(() => {
|
|
31757
|
+
try {
|
|
31758
|
+
const cleanId = userId.split('@')[0];
|
|
31759
|
+
// Limpiar cache de dispositivos del usuario
|
|
31760
|
+
this.userDevicesCache?.del(cleanId);
|
|
31761
|
+
this.userDevicesCache?.del(userId);
|
|
31762
|
+
// Limpiar cache de reintentos de mensajes
|
|
31763
|
+
const msgKey = `${userId}_${messageCtx.key?.id}`;
|
|
31764
|
+
this.msgRetryCounterCache?.del(msgKey);
|
|
31765
|
+
}
|
|
31766
|
+
catch (error) {
|
|
31767
|
+
this.logger.log(`❌ Error en cleanup para usuario problemático ${userId}:`, error.message);
|
|
31768
|
+
}
|
|
31769
|
+
});
|
|
31770
|
+
return true;
|
|
31771
|
+
}
|
|
31772
|
+
return false;
|
|
31773
|
+
}
|
|
31737
31774
|
shouldReconnect(statusCode) {
|
|
31738
31775
|
// Lista de códigos donde SÍ debemos reconectar
|
|
31739
31776
|
const reconnectableCodes = [
|
package/dist/index.mjs
CHANGED
|
@@ -30957,6 +30957,8 @@ class BaileysProvider extends ProviderClass {
|
|
|
30957
30957
|
this.reconnectDelay = 1000; // 1 segundo inicial
|
|
30958
30958
|
this.idsDuplicates = [];
|
|
30959
30959
|
this.mapSet = new Set();
|
|
30960
|
+
// ✅ Configuración escalable para usuarios problemáticos
|
|
30961
|
+
this.PROBLEMATIC_USERS = new Set(['@lid']);
|
|
30960
30962
|
this.indexHome = (req, res) => {
|
|
30961
30963
|
try {
|
|
30962
30964
|
const botName = req[this.idBotName];
|
|
@@ -31179,8 +31181,11 @@ class BaileysProvider extends ProviderClass {
|
|
|
31179
31181
|
messageCtx.messageStubParameters[0].includes('No session'))
|
|
31180
31182
|
continue;
|
|
31181
31183
|
if (messageCtx?.messageStubParameters?.length &&
|
|
31182
|
-
messageCtx.messageStubParameters[0].includes('Bad MAC'))
|
|
31184
|
+
messageCtx.messageStubParameters[0].includes('Bad MAC')) {
|
|
31185
|
+
// Manejo específico para usuarios problemáticos
|
|
31186
|
+
this.handleBadMACForProblematicUser(messageCtx);
|
|
31183
31187
|
continue;
|
|
31188
|
+
}
|
|
31184
31189
|
if (messageCtx?.messageStubParameters?.length &&
|
|
31185
31190
|
messageCtx.messageStubParameters[0].includes('Invalid')) {
|
|
31186
31191
|
if (this.globalVendorArgs.fallBackAction) {
|
|
@@ -31732,6 +31737,38 @@ class BaileysProvider extends ProviderClass {
|
|
|
31732
31737
|
.get('/', this.indexHome);
|
|
31733
31738
|
}
|
|
31734
31739
|
afterHttpServerInit() { }
|
|
31740
|
+
/**
|
|
31741
|
+
* Manejo específico de errores Bad MAC para usuarios problemáticos
|
|
31742
|
+
* @param messageCtx Contexto del mensaje con error
|
|
31743
|
+
* @returns true si se manejó el usuario problemático, false si no
|
|
31744
|
+
*/
|
|
31745
|
+
handleBadMACForProblematicUser(messageCtx) {
|
|
31746
|
+
const userId = messageCtx?.key?.remoteJid;
|
|
31747
|
+
if (!userId)
|
|
31748
|
+
return false;
|
|
31749
|
+
// Verificación rápida y eficiente
|
|
31750
|
+
const isProblematic = Array.from(this.PROBLEMATIC_USERS).some(user => userId.includes(user));
|
|
31751
|
+
if (isProblematic) {
|
|
31752
|
+
this.logger.log(`🔧 [${new Date().toISOString()}] Bad MAC en usuario problemático: ${userId}`);
|
|
31753
|
+
// Cleanup eficiente y no-bloqueante
|
|
31754
|
+
setImmediate(() => {
|
|
31755
|
+
try {
|
|
31756
|
+
const cleanId = userId.split('@')[0];
|
|
31757
|
+
// Limpiar cache de dispositivos del usuario
|
|
31758
|
+
this.userDevicesCache?.del(cleanId);
|
|
31759
|
+
this.userDevicesCache?.del(userId);
|
|
31760
|
+
// Limpiar cache de reintentos de mensajes
|
|
31761
|
+
const msgKey = `${userId}_${messageCtx.key?.id}`;
|
|
31762
|
+
this.msgRetryCounterCache?.del(msgKey);
|
|
31763
|
+
}
|
|
31764
|
+
catch (error) {
|
|
31765
|
+
this.logger.log(`❌ Error en cleanup para usuario problemático ${userId}:`, error.message);
|
|
31766
|
+
}
|
|
31767
|
+
});
|
|
31768
|
+
return true;
|
|
31769
|
+
}
|
|
31770
|
+
return false;
|
|
31771
|
+
}
|
|
31735
31772
|
shouldReconnect(statusCode) {
|
|
31736
31773
|
// Lista de códigos donde SÍ debemos reconectar
|
|
31737
31774
|
const reconnectableCodes = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/provider-baileys",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2-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>",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@builderbot/bot": "^1.3.
|
|
41
|
+
"@builderbot/bot": "^1.3.2-alpha.0",
|
|
42
42
|
"@hapi/boom": "^10.0.1",
|
|
43
43
|
"@jest/globals": "^29.7.0",
|
|
44
44
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
70
70
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
71
|
-
"@leifermendez/baileys": "^6.7.
|
|
71
|
+
"@leifermendez/baileys": "^6.7.24",
|
|
72
72
|
"@types/polka": "^0.5.7",
|
|
73
73
|
"fluent-ffmpeg": "^2.1.2",
|
|
74
74
|
"fs-extra": "^11.2.0",
|
|
75
75
|
"node-cache": "^5.1.2",
|
|
76
76
|
"sharp": "0.33.3"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "ef34d9312feadf024cd42b948af88c2dc724fc0e"
|
|
79
79
|
}
|