@builderbot/provider-baileys 1.3.4 → 1.3.5-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/provider-baileys",
3
- "version": "1.3.4",
3
+ "version": "1.3.5-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>",
@@ -70,11 +70,12 @@
70
70
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
71
71
  "@types/polka": "^0.5.7",
72
72
  "baileys": "^6.7.19",
73
+ "baileys-mod": "^6.8.5",
73
74
  "fluent-ffmpeg": "^2.1.2",
74
75
  "fs-extra": "^11.2.0",
75
76
  "jimp": "^1.6.0",
76
77
  "node-cache": "^5.1.2",
77
78
  "sharp": "0.33.3"
78
79
  },
79
- "gitHead": "cd87c245c33c8da9be9386b498d561484021c1c9"
80
+ "gitHead": "0175b48e338df25d6adfce33eb5863d35393a349"
80
81
  }
package/dist/bailey.d.ts DELETED
@@ -1,196 +0,0 @@
1
- import { ProviderClass } from '@builderbot/bot';
2
- import type { BotContext, Button, SendOptions } from '@builderbot/bot/dist/types';
3
- import type { PathOrFileDescriptor } from 'fs';
4
- import NodeCache from 'node-cache';
5
- import type polka from 'polka';
6
- import type { IStickerOptions } from 'wa-sticker-formatter';
7
-
8
- import { BaileysEventMap, WAMessage, WASocket, proto } from './baileyWrapper';
9
- import type { BaileyGlobalVendorArgs } from './type';
10
- declare class BaileysProvider extends ProviderClass<WASocket> {
11
- globalVendorArgs: BaileyGlobalVendorArgs;
12
- private reconnectAttempts;
13
- private maxReconnectAttempts;
14
- private reconnectDelay;
15
- msgRetryCounterCache?: NodeCache;
16
- userDevicesCache?: NodeCache;
17
- private logger;
18
- private logStream;
19
- private idsDuplicates;
20
- private mapSet;
21
- constructor(args: Partial<BaileyGlobalVendorArgs>);
22
- /**
23
- * Setup cleanup handlers
24
- * @description
25
- * - Remove existing listeners to prevent duplicates
26
- * - Add new listeners
27
- * - Add cleanup function to all listeners
28
- * - Add cleanup function to uncaughtException and unhandledRejection
29
- * - Add cleanup function to SIGINT, SIGTERM, SIGUSR1, SIGUSR2
30
- * - Add cleanup function to process.exit
31
- */
32
- private setupCleanupHandlers;
33
- private setupPeriodicCleanup;
34
- private cleanup;
35
- releaseSessionFiles(): Promise<void>;
36
- protected beforeHttpServerInit(): void;
37
- protected afterHttpServerInit(): void;
38
- indexHome: polka.Middleware;
39
- protected getMessage: (key: {
40
- remoteJid: string;
41
- id: string;
42
- }) => Promise<proto.Message>;
43
- protected saveCredsGlobal: (() => Promise<void>) | null;
44
- /**
45
- * Iniciar todo Bailey
46
- */
47
- protected initVendor: () => Promise<import("baileys").BaileysEventEmitter & {
48
- process(handler: (events: Partial<import("baileys").BaileysEventMap>) => void | Promise<void>): () => void;
49
- buffer(): void;
50
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
51
- flush(): boolean;
52
- isBuffering(): boolean;
53
- }>;
54
- /**
55
- * Map native events that the Provider class expects
56
- * to have a standard set of events
57
- * @returns
58
- */
59
- protected busEvents: () => {
60
- event: keyof BaileysEventMap;
61
- func: (arg?: any, arg2?: any) => any;
62
- }[];
63
- /**
64
- * @param {string} orderId
65
- * @param {string} orderToken
66
- * @example await getOrderDetails('order-id', 'order-token')
67
- */
68
- getOrderDetails: (orderId: string, orderToken: string) => Promise<import("baileys").OrderDetails>;
69
- /**
70
- * @param {string} number
71
- * @param {string} message
72
- * @example await sendMessage('+XXXXXXXXXXX', 'https://dominio.com/imagen.jpg' | 'img/imagen.jpg')
73
- */
74
- sendMedia: (number: string, imageUrl: string, text: string) => Promise<proto.WebMessageInfo>;
75
- /**
76
- * Enviar imagen
77
- * @param {*} number
78
- * @param {*} imageUrl
79
- * @param {*} text
80
- * @returns
81
- */
82
- sendImage: (number: string, filePath: string, text: any) => Promise<proto.WebMessageInfo>;
83
- /**
84
- * Enviar video
85
- * @param {*} number
86
- * @param {*} imageUrl
87
- * @param {*} text
88
- * @returns
89
- */
90
- sendVideo: (number: string, filePath: PathOrFileDescriptor, text: any) => Promise<proto.WebMessageInfo>;
91
- /**
92
- * Enviar audio
93
- * @alpha
94
- * @param {string} number
95
- * @param {string} message
96
- * @param {boolean} voiceNote optional
97
- * @example await sendMessage('+XXXXXXXXXXX', 'audio.mp3')
98
- */
99
- sendAudio: (number: string, audioUrl: string) => Promise<proto.WebMessageInfo>;
100
- /**
101
- *
102
- * @param {string} number
103
- * @param {string} message
104
- * @returns
105
- */
106
- sendText: (number: string, message: string) => Promise<proto.WebMessageInfo>;
107
- /**
108
- *
109
- * @param {string} number
110
- * @param {string} filePath
111
- * @example await sendMessage('+XXXXXXXXXXX', './document/file.pdf')
112
- */
113
- sendFile: (number: string, filePath: string, text: string) => Promise<proto.WebMessageInfo>;
114
- /**
115
- * @deprecated Buttons are not available in this provider, please use sendButtons instead
116
- * @private
117
- * @param {string} number
118
- * @param {string} text
119
- * @param {string} footer
120
- * @param {Array} buttons
121
- * @example await sendMessage("+XXXXXXXXXXX", "Your Text", "Your Footer", [{"buttonId": "id", "buttonText": {"displayText": "Button"}, "type": 1}])
122
- */
123
- sendButtons: (number: string, text: string, buttons: Button[]) => Promise<proto.WebMessageInfo>;
124
- /**
125
- *
126
- * @param {string} number
127
- * @param {string} text
128
- * @param {string} footer
129
- * @param {Array} poll
130
- * @example await sendMessage("+XXXXXXXXXXX", { poll: { "name": "You accept terms", "values": [ "Yes", "Not"], "selectableCount": 1 })
131
- */
132
- sendPoll: (numberIn: string, text: string, poll: {
133
- options: string[];
134
- multiselect: any;
135
- }) => Promise<false | proto.WebMessageInfo>;
136
- /**
137
- * TODO: Necesita terminar de implementar el sendMedia y sendButton guiarse:
138
- * https://github.com/leifermendez/bot-whatsapp/blob/4e0fcbd8347f8a430adb43351b5415098a5d10df/packages/provider/src/web-whatsapp/index.js#L165
139
- * @param {string} number
140
- * @param {string} message
141
- * @example await sendMessage('+XXXXXXXXXXX', 'Hello World')
142
- */
143
- sendMessage: (numberIn: string, message: string, options?: SendOptions) => Promise<any>;
144
- /**
145
- * @param {string} remoteJid
146
- * @param {string} latitude
147
- * @param {string} longitude
148
- * @param {any} messages
149
- * @example await sendLocation("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "xx.xxxx", "xx.xxxx", messages)
150
- */
151
- sendLocation: (remoteJid: string, latitude: any, longitude: any, messages?: any) => Promise<{
152
- status: string;
153
- }>;
154
- /**
155
- * @param {string} remoteJid
156
- * @param {string} contactNumber
157
- * @param {string} displayName
158
- * @param {string} orgName
159
- * @param {any} messages - optional
160
- * @example await sendContact("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "+xxxxxxxxxxx", "Robin Smith", messages)
161
- */
162
- sendContact: (remoteJid: any, contactNumber: {
163
- replaceAll: (arg0: string, arg1: string) => any;
164
- }, displayName: string, orgName: string, messages?: any) => Promise<{
165
- status: string;
166
- }>;
167
- /**
168
- * @param {string} remoteJid
169
- * @param {string} WAPresence
170
- * @example await sendPresenceUpdate("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "recording")
171
- */
172
- sendPresenceUpdate: (remoteJid: any, WAPresence: any) => Promise<void>;
173
- /**
174
- * @param {string} remoteJid
175
- * @param {string} url
176
- * @param {object} stickerOptions
177
- * @param {any} messages - optional
178
- * @example await sendSticker("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "https://dn/image.png" || "https://dn/image.gif" || "https://dn/image.mp4", {pack: 'User', author: 'Me'} messages)
179
- */
180
- sendSticker: (remoteJid: any, url: string | Buffer, stickerOptions: Partial<IStickerOptions>, messages?: any) => Promise<void>;
181
- private getMimeType;
182
- private generateFileName;
183
- /**
184
- * Return Path absolute
185
- * @param ctx
186
- * @param options
187
- * @returns
188
- */
189
- saveFile: (ctx: Partial<WAMessage & BotContext>, options?: {
190
- path: string;
191
- }) => Promise<string>;
192
- private shouldReconnect;
193
- private delayedReconnect;
194
- }
195
- export { BaileysProvider };
196
- //# sourceMappingURL=bailey.d.ts.map
@@ -1 +0,0 @@
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;gBAEd,IAAI,EAAE,OAAO,CAAC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ED,OAAO,CAAC,eAAe;YAmBT,gBAAgB;CA8BjC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,3 +0,0 @@
1
- import { useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, PollMessageOptions, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast, makeWASocket as makeWASocketOther } from 'baileys';
2
- export { makeWASocketOther, useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, PollMessageOptions, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast, };
3
- //# sourceMappingURL=baileyWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"baileyWrapper.d.ts","sourceRoot":"","sources":["../src/baileyWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,YAAY,IAAI,iBAAiB,EACpC,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,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,GACjB,CAAA"}