@builderbot/provider-baileys 1.3.5 → 1.3.7-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 +34 -84
- package/dist/bailey.d.ts.map +1 -1
- package/dist/baileyWrapper.d.ts +2 -2
- package/dist/baileyWrapper.d.ts.map +1 -1
- package/dist/index.cjs +130 -592
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +119 -580
- package/dist/type.d.ts +1 -1
- package/dist/type.d.ts.map +1 -1
- package/dist/utils.d.ts +8 -72
- package/dist/utils.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/bailey.d.ts
CHANGED
|
@@ -19,15 +19,6 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
19
19
|
private idsDuplicates;
|
|
20
20
|
private mapSet;
|
|
21
21
|
constructor(args: Partial<BaileyGlobalVendorArgs>);
|
|
22
|
-
/**
|
|
23
|
-
* Setup console filter to simplify specific error messages
|
|
24
|
-
* @description
|
|
25
|
-
* - Override console.log, console.error, console.warn to show simplified versions of decrypt-related errors
|
|
26
|
-
* - Shows only error titles without stack traces for "Failed to decrypt message", "Bad MAC", "Session error" messages
|
|
27
|
-
* - Shows simplified messages for session management: "Closing open session", "Closing session: SessionEntry"
|
|
28
|
-
* - Other messages are displayed normally
|
|
29
|
-
*/
|
|
30
|
-
private setupConsoleFilter;
|
|
31
22
|
/**
|
|
32
23
|
* Setup cleanup handlers
|
|
33
24
|
* @description
|
|
@@ -48,7 +39,7 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
48
39
|
protected getMessage: (key: {
|
|
49
40
|
remoteJid: string;
|
|
50
41
|
id: string;
|
|
51
|
-
}) => Promise<
|
|
42
|
+
}) => Promise<proto.Message>;
|
|
52
43
|
protected saveCredsGlobal: (() => Promise<void>) | null;
|
|
53
44
|
/**
|
|
54
45
|
* Iniciar todo Bailey
|
|
@@ -69,18 +60,44 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
69
60
|
event: keyof BaileysEventMap;
|
|
70
61
|
func: (arg?: any, arg2?: any) => any;
|
|
71
62
|
}[];
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param {string} number
|
|
66
|
+
* @param {string} text
|
|
67
|
+
* @param {string} footer
|
|
68
|
+
* @param {Array} poll
|
|
69
|
+
* @example await sendMessage("+XXXXXXXXXXX", { poll: { "name": "You accept terms", "values": [ "Yes", "Not"], "selectableCount": 1 })
|
|
70
|
+
*/
|
|
71
|
+
sendPoll: (numberIn: string, text: string, poll: {
|
|
72
|
+
options: string[];
|
|
73
|
+
multiselect: any;
|
|
74
|
+
}) => Promise<false | WAMessage>;
|
|
72
75
|
/**
|
|
73
76
|
* @param {string} orderId
|
|
74
77
|
* @param {string} orderToken
|
|
75
78
|
* @example await getOrderDetails('order-id', 'order-token')
|
|
76
79
|
*/
|
|
77
80
|
getOrderDetails: (orderId: string, orderToken: string) => Promise<import("baileys").OrderDetails>;
|
|
81
|
+
/**
|
|
82
|
+
* Obtener LID (Local Identifier) para un número de teléfono (PN)
|
|
83
|
+
* @param {string} phoneNumber - Número de teléfono en formato JID (e.g., '1234567890@s.whatsapp.net')
|
|
84
|
+
* @returns {Promise<string|null>} - El LID correspondiente o null si no se encuentra
|
|
85
|
+
* @example await getLIDForPN('1234567890@s.whatsapp.net')
|
|
86
|
+
*/
|
|
87
|
+
getLIDForPN: (phoneNumber: string) => Promise<any>;
|
|
88
|
+
/**
|
|
89
|
+
* Obtener número de teléfono (PN) para un LID (Local Identifier)
|
|
90
|
+
* @param {string} lid - Local Identifier
|
|
91
|
+
* @returns {Promise<string|null>} - El número de teléfono correspondiente o null si no se encuentra
|
|
92
|
+
* @example await getPNForLID('lid:xxxxxx')
|
|
93
|
+
*/
|
|
94
|
+
getPNForLID: (lid: string) => Promise<any>;
|
|
78
95
|
/**
|
|
79
96
|
* @param {string} number
|
|
80
97
|
* @param {string} message
|
|
81
98
|
* @example await sendMessage('+XXXXXXXXXXX', 'https://dominio.com/imagen.jpg' | 'img/imagen.jpg')
|
|
82
99
|
*/
|
|
83
|
-
sendMedia: (number: string, imageUrl: string, text: string) => Promise<
|
|
100
|
+
sendMedia: (number: string, imageUrl: string, text: string) => Promise<WAMessage>;
|
|
84
101
|
/**
|
|
85
102
|
* Enviar imagen
|
|
86
103
|
* @param {*} number
|
|
@@ -88,7 +105,7 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
88
105
|
* @param {*} text
|
|
89
106
|
* @returns
|
|
90
107
|
*/
|
|
91
|
-
sendImage: (number: string, filePath: string, text: any) => Promise<
|
|
108
|
+
sendImage: (number: string, filePath: string, text: any) => Promise<WAMessage>;
|
|
92
109
|
/**
|
|
93
110
|
* Enviar video
|
|
94
111
|
* @param {*} number
|
|
@@ -96,7 +113,7 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
96
113
|
* @param {*} text
|
|
97
114
|
* @returns
|
|
98
115
|
*/
|
|
99
|
-
sendVideo: (number: string, filePath: PathOrFileDescriptor, text: any) => Promise<
|
|
116
|
+
sendVideo: (number: string, filePath: PathOrFileDescriptor, text: any) => Promise<WAMessage>;
|
|
100
117
|
/**
|
|
101
118
|
* Enviar audio
|
|
102
119
|
* @alpha
|
|
@@ -105,21 +122,21 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
105
122
|
* @param {boolean} voiceNote optional
|
|
106
123
|
* @example await sendMessage('+XXXXXXXXXXX', 'audio.mp3')
|
|
107
124
|
*/
|
|
108
|
-
sendAudio: (number: string, audioUrl: string) => Promise<
|
|
125
|
+
sendAudio: (number: string, audioUrl: string) => Promise<WAMessage>;
|
|
109
126
|
/**
|
|
110
127
|
*
|
|
111
128
|
* @param {string} number
|
|
112
129
|
* @param {string} message
|
|
113
130
|
* @returns
|
|
114
131
|
*/
|
|
115
|
-
sendText: (number: string, message: string) => Promise<
|
|
132
|
+
sendText: (number: string, message: string) => Promise<WAMessage>;
|
|
116
133
|
/**
|
|
117
134
|
*
|
|
118
135
|
* @param {string} number
|
|
119
136
|
* @param {string} filePath
|
|
120
137
|
* @example await sendMessage('+XXXXXXXXXXX', './document/file.pdf')
|
|
121
138
|
*/
|
|
122
|
-
sendFile: (number: string, filePath: string, text: string) => Promise<
|
|
139
|
+
sendFile: (number: string, filePath: string, text: string) => Promise<WAMessage>;
|
|
123
140
|
/**
|
|
124
141
|
* @deprecated Buttons are not available in this provider, please use sendButtons instead
|
|
125
142
|
* @private
|
|
@@ -129,19 +146,7 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
129
146
|
* @param {Array} buttons
|
|
130
147
|
* @example await sendMessage("+XXXXXXXXXXX", "Your Text", "Your Footer", [{"buttonId": "id", "buttonText": {"displayText": "Button"}, "type": 1}])
|
|
131
148
|
*/
|
|
132
|
-
sendButtons: (number: string, text: string, buttons: Button[]) => Promise<
|
|
133
|
-
/**
|
|
134
|
-
*
|
|
135
|
-
* @param {string} number
|
|
136
|
-
* @param {string} text
|
|
137
|
-
* @param {string} footer
|
|
138
|
-
* @param {Array} poll
|
|
139
|
-
* @example await sendMessage("+XXXXXXXXXXX", { poll: { "name": "You accept terms", "values": [ "Yes", "Not"], "selectableCount": 1 })
|
|
140
|
-
*/
|
|
141
|
-
sendPoll: (numberIn: string, text: string, poll: {
|
|
142
|
-
options: string[];
|
|
143
|
-
multiselect: any;
|
|
144
|
-
}) => Promise<false | proto.WebMessageInfo>;
|
|
149
|
+
sendButtons: (number: string, text: string, buttons: Button[]) => Promise<WAMessage>;
|
|
145
150
|
/**
|
|
146
151
|
* TODO: Necesita terminar de implementar el sendMedia y sendButton guiarse:
|
|
147
152
|
* https://github.com/leifermendez/bot-whatsapp/blob/4e0fcbd8347f8a430adb43351b5415098a5d10df/packages/provider/src/web-whatsapp/index.js#L165
|
|
@@ -198,63 +203,8 @@ declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
|
198
203
|
saveFile: (ctx: Partial<WAMessage & BotContext>, options?: {
|
|
199
204
|
path: string;
|
|
200
205
|
}) => Promise<string>;
|
|
201
|
-
/**
|
|
202
|
-
* Extracts sender information from MessageKey using Baileys v7.0.0+ Alt fields
|
|
203
|
-
* FOLLOWS OFFICIAL GUIDANCE: Prefers LIDs over PNs as per Baileys documentation
|
|
204
|
-
* Reference: https://baileys.wiki/docs/migration/to-v7.0.0
|
|
205
|
-
* @param key MessageKey with potential remoteJidAlt/participantAlt fields
|
|
206
|
-
* @returns Object with identifier (preferring LID per official guidance), type, and isLID flag
|
|
207
|
-
*/
|
|
208
|
-
private extractSenderWithAltFields;
|
|
209
|
-
/**
|
|
210
|
-
* CRITICAL FIX for Baileys v7.0.0+ LID sync issues
|
|
211
|
-
* Resolves LID to PN for outgoing messages to ensure they appear in WhatsApp app
|
|
212
|
-
*
|
|
213
|
-
* Issue: Messages sent to LIDs from linked devices don't sync to main WhatsApp app
|
|
214
|
-
* Solution: Convert LIDs to PNs when sending messages (keep LIDs for receiving)
|
|
215
|
-
*
|
|
216
|
-
* @param identifier The identifier to resolve (LID or PN)
|
|
217
|
-
* @returns PN format for reliable message sending
|
|
218
|
-
*/
|
|
219
|
-
private resolveLIDToPNForSending;
|
|
220
206
|
private shouldReconnect;
|
|
221
207
|
private delayedReconnect;
|
|
222
|
-
/**
|
|
223
|
-
* Validates if the auth state supports LID system (lid-mapping and device-index keys)
|
|
224
|
-
* Required for Baileys v7.0.0+ LID system
|
|
225
|
-
* @param state The authentication state from useMultiFileAuthState
|
|
226
|
-
*/
|
|
227
|
-
private validateLIDSupport;
|
|
228
|
-
/**
|
|
229
|
-
* Checks if the auth state has LID system support
|
|
230
|
-
* @param state The authentication state
|
|
231
|
-
* @returns boolean indicating LID support
|
|
232
|
-
*/
|
|
233
|
-
private hasLIDSupport;
|
|
234
|
-
/**
|
|
235
|
-
* Gets the LID mapping store from the socket
|
|
236
|
-
* @returns The LID mapping store or null if not available
|
|
237
|
-
*/
|
|
238
|
-
getLIDMappingStore(): any;
|
|
239
|
-
/**
|
|
240
|
-
* Public method to get LID from PN using the internal store
|
|
241
|
-
* @param phoneNumber Phone number to get LID for
|
|
242
|
-
* @returns Promise<string | null> LID or null if not found
|
|
243
|
-
*/
|
|
244
|
-
getLIDFromPN(phoneNumber: string): Promise<string | null>;
|
|
245
|
-
/**
|
|
246
|
-
* Public method to get PN from LID using the internal store
|
|
247
|
-
* @param lid LID to get phone number for
|
|
248
|
-
* @returns Promise<string | null> Phone number or null if not found
|
|
249
|
-
*/
|
|
250
|
-
getPNFromLID(lid: string): Promise<string | null>;
|
|
251
|
-
/**
|
|
252
|
-
* Public method to store a LID-PN mapping
|
|
253
|
-
* @param lid Local Identifier
|
|
254
|
-
* @param phoneNumber Phone Number
|
|
255
|
-
* @returns Promise<boolean> Success status
|
|
256
|
-
*/
|
|
257
|
-
storeLIDPNMapping(lid: string, phoneNumber: string): Promise<boolean>;
|
|
258
208
|
}
|
|
259
209
|
export { BaileysProvider };
|
|
260
210
|
//# sourceMappingURL=bailey.d.ts.map
|
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;
|
|
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,K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;;;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;IAED,OAAO,CAAC,eAAe;YAmBT,gBAAgB;CA+BjC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/dist/baileyWrapper.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent,
|
|
2
|
-
export { makeWASocketOther, useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent,
|
|
1
|
+
import makeWASocketOther, { useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast, PollMessageOptions, WAVersion, WABrowserDescription } from 'baileys';
|
|
2
|
+
export { makeWASocketOther, useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast, PollMessageOptions, WAVersion, WABrowserDescription, };
|
|
3
3
|
//# sourceMappingURL=baileyWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baileyWrapper.d.ts","sourceRoot":"","sources":["../src/baileyWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"baileyWrapper.d.ts","sourceRoot":"","sources":["../src/baileyWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,EAAE,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACvB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,oBAAoB,GACvB,CAAA"}
|