whatsbotcord 1.0.2 → 2.0.0-RC.1

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.
Files changed (46) hide show
  1. package/README.md +5 -4
  2. package/dist/Debugging.helper-CfBRq3_3.cjs +89 -0
  3. package/dist/Debugging.helper-CfBRq3_3.cjs.map +1 -0
  4. package/dist/Debugging.helper-DeLzvUaq.d.cts +387 -0
  5. package/dist/Debugging.helper-DeLzvUaq.d.cts.map +1 -0
  6. package/dist/Debugging.helper-Xj3cZp1P.d.mts +387 -0
  7. package/dist/Debugging.helper-Xj3cZp1P.d.mts.map +1 -0
  8. package/dist/Debugging.helper-mWe_MZwA.mjs +48 -0
  9. package/dist/Debugging.helper-mWe_MZwA.mjs.map +1 -0
  10. package/dist/WorkflowNumeric.many-BMO9ua8Q.cjs +5649 -0
  11. package/dist/WorkflowNumeric.many-BMO9ua8Q.cjs.map +1 -0
  12. package/dist/WorkflowNumeric.many-CWm5yeOD.d.cts +4981 -0
  13. package/dist/WorkflowNumeric.many-CWm5yeOD.d.cts.map +1 -0
  14. package/dist/WorkflowNumeric.many-DJjJ8Zsn.mjs +5431 -0
  15. package/dist/WorkflowNumeric.many-DJjJ8Zsn.mjs.map +1 -0
  16. package/dist/WorkflowNumeric.many-UPxAqY1f.d.mts +4981 -0
  17. package/dist/WorkflowNumeric.many-UPxAqY1f.d.mts.map +1 -0
  18. package/dist/debugging.cjs +3 -0
  19. package/dist/debugging.d.cts +2 -0
  20. package/dist/debugging.d.mts +2 -0
  21. package/dist/debugging.mjs +2 -0
  22. package/dist/helpers.cjs +19 -0
  23. package/dist/helpers.d.cts +2 -0
  24. package/dist/helpers.d.mts +2 -0
  25. package/dist/helpers.mjs +2 -0
  26. package/dist/index.cjs +20 -4431
  27. package/dist/index.d.cts +3 -4324
  28. package/dist/index.d.mts +3 -4324
  29. package/dist/index.mjs +2 -4385
  30. package/dist/testing.cjs +33 -0
  31. package/dist/testing.cjs.map +1 -0
  32. package/dist/testing.d.cts +92 -0
  33. package/dist/testing.d.cts.map +1 -0
  34. package/dist/testing.d.mts +92 -0
  35. package/dist/testing.d.mts.map +1 -0
  36. package/dist/testing.mjs +28 -0
  37. package/dist/testing.mjs.map +1 -0
  38. package/dist/types.cjs +1 -0
  39. package/dist/types.d.cts +3 -0
  40. package/dist/types.d.mts +3 -0
  41. package/dist/types.mjs +1 -0
  42. package/package.json +101 -82
  43. package/dist/index.cjs.map +0 -1
  44. package/dist/index.d.cts.map +0 -1
  45. package/dist/index.d.mts.map +0 -1
  46. package/dist/index.mjs.map +0 -1
package/README.md CHANGED
@@ -11,10 +11,11 @@
11
11
  **_WhatsBotCord_** is a lightweight, TypeScript-based library for building WhatsApp bots with a Discord-inspired command system (e.g., **!yourcommand**, **@everyone**, and _more_). Built as a wrapper around Baileys.js, it abstracts complex Baileys.js internals, providing an intuitive, type-safe interface for managing WhatsApp groups and individual chats. Designed from developers to developers to create custom bots with ease.
12
12
  **🔥 Want to know what's new?** Check out the [**latest releases**](https://github.com/KristanLaimon/WhatsBotCord.js/releases) for documentation and usage examples.
13
13
 
14
- 🟢 [Official Documentation Site (In progress)](https://whats-bot-cord-js-documentation.vercel.app/)
15
- 📃 [Documentation with AI (DeepWiki)](https://deepwiki.com/KristanLaimon/WhatsBotCord.js)
16
-
17
- > This project has been battle-tested enough, I'm currently creating release candidates for the final v1.0.0. Documentation site is now online!
14
+ <div align="center">
15
+ <a href="https://whats-bot-cord-js-documentation.vercel.app/">🟢 Official Documentation Site</a>
16
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
17
+ <a href="https://deepwiki.com/KristanLaimon/WhatsBotCord.js">📃 Documentation with AI (DeepWiki)</a>
18
+ </div>
18
19
 
19
20
  ## Features
20
21
 
@@ -0,0 +1,89 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ let node_fs = require("node:fs");
24
+ node_fs = __toESM(node_fs);
25
+ let node_path = require("node:path");
26
+ node_path = __toESM(node_path);
27
+ //#region src/libs/BunPath.ts
28
+ /**
29
+ * # Get Path
30
+ *
31
+ * Do not use this anymore, it's the same as using path.join.
32
+ * @deprecated Do not use this anymore, it used to work as a compile/not-compile path management, but that doesn't have sense
33
+ * in a library...
34
+ */
35
+ function GetPath(...filePathToAppendFromRoot) {
36
+ if (filePathToAppendFromRoot.length === 0) return "";
37
+ return node_path.default.join(...filePathToAppendFromRoot);
38
+ }
39
+ //#endregion
40
+ //#region src/Debugging.helper.ts
41
+ /**
42
+ * # Store Message in History JSON
43
+ *
44
+ * Stores the incoming WhatsApp message into a local JSON file for debugging purposes.
45
+ * If the file does not exist, it creates it.
46
+ *
47
+ * @param filePath - The path to the JSON file where history will be stored.
48
+ * @param rawMsg - The raw WhatsApp message object to store.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * Debug_StoreWhatsMsgHistoryInJson("./debug_history.json", rawMsg);
53
+ * ```
54
+ */
55
+ function Debug_StoreWhatsMsgHistoryInJson(filePath, rawMsg) {
56
+ let msgsStored = [];
57
+ if (node_fs.default.existsSync(GetPath(filePath))) {
58
+ const before = node_fs.default.readFileSync(GetPath(filePath), "utf-8");
59
+ if (before.trim() === "") msgsStored = [];
60
+ else msgsStored = JSON.parse(before);
61
+ } else {
62
+ node_fs.default.writeFileSync(GetPath(filePath), "", "utf-8");
63
+ msgsStored = [];
64
+ }
65
+ msgsStored.push(rawMsg);
66
+ const json = JSON.stringify(msgsStored, null, 2);
67
+ node_fs.default.writeFileSync(GetPath(filePath), json, "utf-8");
68
+ }
69
+ //#endregion
70
+ Object.defineProperty(exports, "Debug_StoreWhatsMsgHistoryInJson", {
71
+ enumerable: true,
72
+ get: function() {
73
+ return Debug_StoreWhatsMsgHistoryInJson;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "GetPath", {
77
+ enumerable: true,
78
+ get: function() {
79
+ return GetPath;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "__toESM", {
83
+ enumerable: true,
84
+ get: function() {
85
+ return __toESM;
86
+ }
87
+ });
88
+
89
+ //# sourceMappingURL=Debugging.helper-CfBRq3_3.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Debugging.helper-CfBRq3_3.cjs","names":["path","fs"],"sources":["../src/libs/BunPath.ts","../src/Debugging.helper.ts"],"sourcesContent":["import path from \"node:path\";\r\n\r\n/**\r\n * # Get Path\r\n *\r\n * Do not use this anymore, it's the same as using path.join.\r\n * @deprecated Do not use this anymore, it used to work as a compile/not-compile path management, but that doesn't have sense\r\n * in a library...\r\n */\r\nexport function GetPath(...filePathToAppendFromRoot: string[]): string {\r\n if (filePathToAppendFromRoot.length === 0) return \"\";\r\n return path.join(...filePathToAppendFromRoot);\r\n}\r\n","import fs from \"node:fs\";\r\nimport type { WhatsappMessage } from \"./core/whats_socket/types.js\";\r\nimport { GetPath } from \"./libs/BunPath.js\";\r\n\r\n/**\r\n * # Store Message in History JSON\r\n *\r\n * Stores the incoming WhatsApp message into a local JSON file for debugging purposes.\r\n * If the file does not exist, it creates it.\r\n *\r\n * @param filePath - The path to the JSON file where history will be stored.\r\n * @param rawMsg - The raw WhatsApp message object to store.\r\n *\r\n * @example\r\n * ```typescript\r\n * Debug_StoreWhatsMsgHistoryInJson(\"./debug_history.json\", rawMsg);\r\n * ```\r\n */\r\nexport function Debug_StoreWhatsMsgHistoryInJson(filePath: string, rawMsg: WhatsappMessage) {\r\n let msgsStored: any[] = [];\r\n if (fs.existsSync(GetPath(filePath))) {\r\n const before = fs.readFileSync(GetPath(filePath), \"utf-8\");\r\n if (before.trim() === \"\") {\r\n msgsStored = [];\r\n } else {\r\n msgsStored = JSON.parse(before);\r\n }\r\n } else {\r\n //Creates the file if it doesn't exist\r\n fs.writeFileSync(GetPath(filePath), \"\", \"utf-8\");\r\n msgsStored = [];\r\n }\r\n msgsStored.push(rawMsg);\r\n const json = JSON.stringify(msgsStored, null, 2);\r\n fs.writeFileSync(GetPath(filePath), json, \"utf-8\");\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAgB,QAAQ,GAAG,0BAA4C;AACrE,KAAI,yBAAyB,WAAW,EAAG,QAAO;AAClD,QAAOA,UAAAA,QAAK,KAAK,GAAG,yBAAyB;;;;;;;;;;;;;;;;;;ACO/C,SAAgB,iCAAiC,UAAkB,QAAyB;CAC1F,IAAI,aAAoB,EAAE;AAC1B,KAAIC,QAAAA,QAAG,WAAW,QAAQ,SAAS,CAAC,EAAE;EACpC,MAAM,SAASA,QAAAA,QAAG,aAAa,QAAQ,SAAS,EAAE,QAAQ;AAC1D,MAAI,OAAO,MAAM,KAAK,GACpB,cAAa,EAAE;MAEf,cAAa,KAAK,MAAM,OAAO;QAE5B;AAEL,UAAA,QAAG,cAAc,QAAQ,SAAS,EAAE,IAAI,QAAQ;AAChD,eAAa,EAAE;;AAEjB,YAAW,KAAK,OAAO;CACvB,MAAM,OAAO,KAAK,UAAU,YAAY,MAAM,EAAE;AAChD,SAAA,QAAG,cAAc,QAAQ,SAAS,EAAE,MAAM,QAAQ"}
@@ -0,0 +1,387 @@
1
+ //#region src/core/whats_socket/types.d.ts
2
+ /**
3
+ * # Logger Mode
4
+ *
5
+ * Represents the logger mode for WhatsSocket.
6
+ * They are based on the 'pino' library/dependency logger levels. Just extracted them here for convenience.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const mode: WhatsSocketLoggerMode = "silent";
11
+ * ```
12
+ */
13
+ type WhatsSocketLoggerMode = "debug" | "error" | "fatal" | "info" | "silent" | "trace" | "warn" | "recommended";
14
+ /**
15
+ * # WhatsApp Message Key
16
+ *
17
+ * Vendor-neutral identifier block for a WhatsApp message.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const key: WhatsappMessageKey = { remoteJid: "123@g.us", fromMe: false };
22
+ * ```
23
+ */
24
+ type WhatsappMessageKey = {
25
+ remoteJid?: string | null;
26
+ remoteJidAlt?: string | null;
27
+ participant?: string | null;
28
+ participantAlt?: string | null;
29
+ fromMe?: boolean | null;
30
+ id?: string | null;
31
+ [key: string]: any;
32
+ };
33
+ /**
34
+ * # WhatsApp Message Context Info
35
+ *
36
+ * Common metadata attached to a message or message option.
37
+ * Vendors may expose more fields, but these are the fields WhatsBotCord
38
+ * commonly reads or forwards.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const contextInfo: WhatsappMessageContextInfo = { quotedMessage: rawMsg.message };
43
+ * ```
44
+ */
45
+ type WhatsappMessageContextInfo = {
46
+ quotedMessage?: WhatsappProtocolMessage | null;
47
+ stanzaId?: string | null;
48
+ participant?: string | null;
49
+ mentionedJid?: string[] | null;
50
+ expiration?: number | null;
51
+ ephemeralSettingTimestamp?: number | string | null;
52
+ disappearingMode?: {
53
+ initiator?: string | number | null;
54
+ [key: string]: any;
55
+ } | null;
56
+ forwardingScore?: number | null;
57
+ isForwarded?: boolean | null;
58
+ [key: string]: any;
59
+ };
60
+ /**
61
+ * # WhatsApp Protocol Message
62
+ *
63
+ * Minimal message payload shape used by WhatsBotCord internals.
64
+ * Vendor adapters may attach extra fields, but application code should only
65
+ * depend on the fields declared here.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const msg: WhatsappProtocolMessage = { conversation: "hello" };
70
+ * ```
71
+ */
72
+ type WhatsappProtocolMessage = {
73
+ conversation?: string | null;
74
+ extendedTextMessage?: {
75
+ text?: string | null;
76
+ contextInfo?: WhatsappMessageContextInfo | null;
77
+ [key: string]: any;
78
+ } | null;
79
+ imageMessage?: {
80
+ caption?: string | null;
81
+ url?: string | null;
82
+ mimetype?: string | null;
83
+ [key: string]: any;
84
+ } | null;
85
+ videoMessage?: {
86
+ caption?: string | null;
87
+ url?: string | null;
88
+ mimetype?: string | null;
89
+ [key: string]: any;
90
+ } | null;
91
+ audioMessage?: {
92
+ url?: string | null;
93
+ mimetype?: string | null;
94
+ [key: string]: any;
95
+ } | null;
96
+ stickerMessage?: {
97
+ url?: string | null;
98
+ mimetype?: string | null;
99
+ [key: string]: any;
100
+ } | null;
101
+ pollCreationMessage?: Record<string, any> | null;
102
+ pollCreationMessageV3?: {
103
+ name?: string | null;
104
+ selectableOptionsCount?: number | null;
105
+ options?: Array<{
106
+ optionName?: string | null;
107
+ [key: string]: any;
108
+ }> | null;
109
+ [key: string]: any;
110
+ } | null;
111
+ pollUpdateMessage?: WhatsappPollUpdateMessage | null;
112
+ locationMessage?: {
113
+ degreesLatitude?: number | null;
114
+ degreesLongitude?: number | null;
115
+ jpegThumbnail?: Buffer | null;
116
+ isLive?: boolean | null;
117
+ name?: string | null;
118
+ address?: string | null;
119
+ [key: string]: any;
120
+ } | null;
121
+ contactMessage?: {
122
+ displayName?: string | null;
123
+ vcard?: string | null;
124
+ [key: string]: any;
125
+ } | null;
126
+ contactsArrayMessage?: {
127
+ contacts?: Array<{
128
+ displayName?: string | null;
129
+ vcard?: string | null;
130
+ [key: string]: any;
131
+ }> | null;
132
+ [key: string]: any;
133
+ } | null;
134
+ documentMessage?: {
135
+ url?: string | null;
136
+ fileName?: string | null;
137
+ mimetype?: string | null;
138
+ [key: string]: any;
139
+ } | null;
140
+ [key: string]: any;
141
+ };
142
+ /**
143
+ * # WhatsApp Message
144
+ *
145
+ * Vendor-neutral raw message shape used across WhatsBotCord.
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const msg: WhatsappMessage = { key: { remoteJid: "123@s.whatsapp.net" }, message: { conversation: "hello" } };
150
+ * ```
151
+ */
152
+ type WhatsappMessage = {
153
+ key: WhatsappMessageKey;
154
+ message?: WhatsappProtocolMessage | null;
155
+ pushName?: string | null;
156
+ [key: string]: any;
157
+ };
158
+ /**
159
+ * # WhatsApp Message Content
160
+ *
161
+ * Vendor-neutral outgoing message content. The shape intentionally keeps an
162
+ * index signature because WhatsApp vendors expose different optional features.
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * const content: WhatsappMessageContent = { text: "hello" };
167
+ * ```
168
+ */
169
+ type WhatsappMessageContent = {
170
+ text?: string;
171
+ mentions?: string[];
172
+ image?: Buffer | {
173
+ url: string;
174
+ };
175
+ video?: Buffer | {
176
+ url: string;
177
+ };
178
+ audio?: Buffer | {
179
+ url: string;
180
+ };
181
+ sticker?: Buffer | {
182
+ url: string;
183
+ };
184
+ document?: Buffer | {
185
+ url: string;
186
+ };
187
+ mimetype?: string;
188
+ caption?: string;
189
+ fileName?: string;
190
+ react?: {
191
+ text: string;
192
+ key: WhatsappMessageKey;
193
+ };
194
+ poll?: {
195
+ name: string;
196
+ values: string[];
197
+ selectableCount: number;
198
+ };
199
+ location?: {
200
+ degreesLatitude: number;
201
+ degreesLongitude: number;
202
+ name?: string;
203
+ address?: string;
204
+ };
205
+ contacts?: {
206
+ displayName: string;
207
+ contacts: Array<{
208
+ vcard: string;
209
+ }>;
210
+ };
211
+ [key: string]: any;
212
+ };
213
+ /**
214
+ * # WhatsApp Message Options
215
+ *
216
+ * Vendor-neutral message sending options.
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * const options: WhatsappMessageOptions = { quoted: rawMsg };
221
+ * ```
222
+ */
223
+ type WhatsappMessageOptions = {
224
+ /**
225
+ * Message that the new outgoing message should reply to.
226
+ * Each vendor adapter maps this to the vendor-specific quoted-message option.
227
+ */
228
+ quoted?: WhatsappMessage;
229
+ /**
230
+ * Optional context metadata to attach to the outgoing message.
231
+ */
232
+ contextInfo?: WhatsappMessageContextInfo;
233
+ /**
234
+ * Whether the outgoing message is a broadcast/status message.
235
+ */
236
+ broadcast?: boolean;
237
+ /**
238
+ * Contacts allowed to receive a status broadcast.
239
+ */
240
+ statusJidList?: string[];
241
+ /**
242
+ * Ephemeral duration in seconds when the vendor supports disappearing messages.
243
+ */
244
+ ephemeralExpiration?: number;
245
+ [key: string]: any;
246
+ };
247
+ /**
248
+ * # WhatsApp Group Participant
249
+ *
250
+ * Minimal participant metadata shape used by WhatsBotCord.
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * const participant: WhatsappGroupParticipant = { id: "123@s.whatsapp.net", admin: "admin" };
255
+ * ```
256
+ */
257
+ type WhatsappGroupParticipant = {
258
+ id?: string | null;
259
+ lid?: string | null;
260
+ admin?: "admin" | "superadmin" | null;
261
+ [key: string]: any;
262
+ };
263
+ /**
264
+ * # WhatsApp Group Metadata
265
+ *
266
+ * Vendor-neutral group metadata used by WhatsBotCord.
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const group: WhatsappGroupMetadata = { id: "123@g.us", subject: "Group", participants: [] };
271
+ * ```
272
+ */
273
+ type WhatsappGroupMetadata = {
274
+ id: string;
275
+ subject: string;
276
+ participants: WhatsappGroupParticipant[];
277
+ addressingMode?: "pn" | "lid" | string | null;
278
+ subjectOwner?: string | null;
279
+ owner?: string | null;
280
+ desc?: string | null;
281
+ inviteCode?: string | null;
282
+ isCommunity?: boolean | null;
283
+ restrict?: boolean | null;
284
+ announce?: boolean | null;
285
+ memberAddMode?: boolean | null;
286
+ joinApprovalMode?: boolean | null;
287
+ isCommunityAnnounce?: boolean | null;
288
+ ephemeralDuration?: number | null;
289
+ subjectTime?: number | null;
290
+ creation?: number | null;
291
+ [key: string]: any;
292
+ };
293
+ /**
294
+ * # WhatsApp Group Participant Action
295
+ *
296
+ * Vendor-neutral participant update action supported by WhatsApp groups.
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * const action: WhatsappGroupParticipantAction = "promote";
301
+ * ```
302
+ */
303
+ type WhatsappGroupParticipantAction = "add" | "remove" | "promote" | "demote";
304
+ type WhatsappPresenceState = "online" | "offline";
305
+ type WhatsappChatActivity = "typing" | "recording" | "idle";
306
+ type WhatsappMessageUpdate = WhatsappMessage;
307
+ type WhatsappPollUpdateMessage = {
308
+ pollCreationMessageKey?: WhatsappMessageKey | null;
309
+ [key: string]: any;
310
+ };
311
+ type WhatsappPollVote = {
312
+ name: string;
313
+ voters: string[];
314
+ };
315
+ type WhatsSocketConnectionUpdate = {
316
+ connection?: "open" | "close" | string;
317
+ qr?: string;
318
+ lastDisconnect?: {
319
+ error?: unknown;
320
+ statusCode?: number;
321
+ isLoggedOut?: boolean;
322
+ };
323
+ };
324
+ type WhatsSocketIncomingMessagesUpdate = {
325
+ messages?: WhatsappMessage[];
326
+ [key: string]: any;
327
+ };
328
+ type WhatsSocketVendorEventMap = {
329
+ ConnectionStateChanged: (update: WhatsSocketConnectionUpdate) => void | Promise<void>;
330
+ IncomingMessagesReceived: (messageUpdate: WhatsSocketIncomingMessagesUpdate) => void | Promise<void>;
331
+ MessagesUpdated: (messagesUpdates: WhatsappMessageUpdate[]) => void | Promise<void>;
332
+ GroupsJoined: (groups: WhatsappGroupMetadata[]) => void | Promise<void>;
333
+ GroupsUpdated: (groups: Array<Partial<WhatsappGroupMetadata>>) => void | Promise<void>;
334
+ };
335
+ /**
336
+ * # WhatsApp Vendor Client
337
+ *
338
+ * Low-level internal contract implemented by WhatsApp vendor adapters.
339
+ * The rest of the application talks to this interface, never to Baileys
340
+ * or another vendor directly.
341
+ *
342
+ * @example
343
+ * ```typescript
344
+ * const client: IWhatsSocketVendorClient = await factory.Create();
345
+ * client.on("IncomingMessagesReceived", update => console.log(update.messages));
346
+ * ```
347
+ */
348
+ interface IWhatsappSocketAdapterClient {
349
+ readonly ownJID: string;
350
+ on<EventName extends keyof WhatsSocketVendorEventMap>(eventName: EventName, callback: WhatsSocketVendorEventMap[EventName]): void;
351
+ normalizeJid(jid: string): string;
352
+ getBotJid(): string;
353
+ sendMessage(chatId_JID: string, content: WhatsappMessageContent, options?: WhatsappMessageOptions): Promise<WhatsappMessage | null>;
354
+ fetchGroupMetadata(chatId: string): Promise<WhatsappGroupMetadata>;
355
+ fetchAllGroups(): Promise<WhatsappGroupMetadata[]>;
356
+ updateGroupParticipants(groupId: string, participants: string[], action: WhatsappGroupParticipantAction): Promise<boolean>;
357
+ leaveGroup(groupId: string): Promise<void>;
358
+ deleteChatLocally(chatId: string): Promise<void>;
359
+ downloadMediaMessage(rawMsg: WhatsappMessage): Promise<Buffer>;
360
+ getPollVotes(pollRawMsg: WhatsappMessage, pollUpdates: WhatsappPollUpdateMessage[]): Promise<WhatsappPollVote[]>;
361
+ setPresenceState(state: WhatsappPresenceState): Promise<boolean>;
362
+ setChatActivity(chatId_JID: string, activity: WhatsappChatActivity): Promise<boolean>;
363
+ shutdown(): Promise<void>;
364
+ }
365
+ interface IWhatsappAdapter {
366
+ Create(): Promise<IWhatsappSocketAdapterClient>;
367
+ }
368
+ //#endregion
369
+ //#region src/Debugging.helper.d.ts
370
+ /**
371
+ * # Store Message in History JSON
372
+ *
373
+ * Stores the incoming WhatsApp message into a local JSON file for debugging purposes.
374
+ * If the file does not exist, it creates it.
375
+ *
376
+ * @param filePath - The path to the JSON file where history will be stored.
377
+ * @param rawMsg - The raw WhatsApp message object to store.
378
+ *
379
+ * @example
380
+ * ```typescript
381
+ * Debug_StoreWhatsMsgHistoryInJson("./debug_history.json", rawMsg);
382
+ * ```
383
+ */
384
+ declare function Debug_StoreWhatsMsgHistoryInJson(filePath: string, rawMsg: WhatsappMessage): void;
385
+ //#endregion
386
+ export { WhatsSocketVendorEventMap as a, WhatsappGroupParticipantAction as c, WhatsappMessageOptions as d, WhatsappPollUpdateMessage as f, WhatsappProtocolMessage as h, WhatsSocketLoggerMode as i, WhatsappMessage as l, WhatsappPresenceState as m, IWhatsappAdapter as n, WhatsappChatActivity as o, WhatsappPollVote as p, IWhatsappSocketAdapterClient as r, WhatsappGroupMetadata as s, Debug_StoreWhatsMsgHistoryInJson as t, WhatsappMessageContent as u };
387
+ //# sourceMappingURL=Debugging.helper-DeLzvUaq.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Debugging.helper-DeLzvUaq.d.cts","names":[],"sources":["../src/core/whats_socket/types.ts","../src/Debugging.helper.ts"],"mappings":";;AAWA;;;;;AAsBA;;;;;KAtBY,qBAAA;;;;;;;;;;;KAsBA,kBAAA;EACV,SAAA;EACA,YAAA;EACA,WAAA;EACA,cAAA;EACA,MAAA;EACA,EAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;;;;;KAeS,0BAAA;EACV,aAAA,GAAgB,uBAAA;EAChB,QAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,yBAAA;EACA,gBAAA;IACE,SAAA;IAAA,CACC,GAAA;EAAA;EAEH,eAAA;EACA,WAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;;;;;KAeS,uBAAA;EACV,YAAA;EACA,mBAAA;IACE,IAAA;IACA,WAAA,GAAc,0BAAA;IAAA,CACb,GAAA;EAAA;EAEH,YAAA;IAAiB,OAAA;IAAyB,GAAA;IAAqB,QAAA;IAAA,CAA2B,GAAA;EAAA;EAC1F,YAAA;IAAiB,OAAA;IAAyB,GAAA;IAAqB,QAAA;IAAA,CAA2B,GAAA;EAAA;EAC1F,YAAA;IAAiB,GAAA;IAAqB,QAAA;IAAA,CAA2B,GAAA;EAAA;EACjE,cAAA;IAAmB,GAAA;IAAqB,QAAA;IAAA,CAA2B,GAAA;EAAA;EACnE,mBAAA,GAAsB,MAAA;EACtB,qBAAA;IACE,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