@hbmodsofc/baileys 1.5.2 → 1.7.7

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 (155) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/index.js +19671 -152026
  3. package/lib/Defaults/index.d.ts +12 -8
  4. package/lib/Defaults/index.js +90 -124
  5. package/lib/Signal/Group/group_cipher.d.ts +0 -1
  6. package/lib/Signal/Group/group_cipher.js +28 -39
  7. package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
  8. package/lib/Signal/Group/sender-chain-key.js +9 -2
  9. package/lib/Signal/Group/sender-key-distribution-message.js +3 -3
  10. package/lib/Signal/Group/sender-key-message.js +3 -3
  11. package/lib/Signal/Group/sender-key-state.d.ts +4 -4
  12. package/lib/Signal/Group/sender-key-state.js +47 -16
  13. package/lib/Signal/libsignal.d.ts +7 -3
  14. package/lib/Signal/libsignal.js +224 -39
  15. package/lib/Signal/lid-mapping.d.ts +26 -0
  16. package/lib/Signal/lid-mapping.js +146 -0
  17. package/lib/Socket/Client/index.d.ts +2 -3
  18. package/lib/Socket/Client/index.js +2 -3
  19. package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +1 -3
  20. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
  21. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +10 -16
  22. package/lib/Socket/business.d.ts +94 -78
  23. package/lib/Socket/business.js +130 -11
  24. package/lib/Socket/chats.d.ts +63 -233
  25. package/lib/Socket/chats.js +234 -184
  26. package/lib/Socket/communities.d.ts +232 -0
  27. package/lib/Socket/communities.js +402 -0
  28. package/lib/Socket/groups.d.ts +62 -41
  29. package/lib/Socket/groups.js +76 -64
  30. package/lib/Socket/index.d.ts +129 -83
  31. package/lib/Socket/index.js +13 -6
  32. package/lib/Socket/messages-recv.d.ts +59 -48
  33. package/lib/Socket/messages-recv.js +516 -371
  34. package/lib/Socket/messages-send.d.ts +86 -67
  35. package/lib/Socket/messages-send.js +1091 -1
  36. package/lib/Socket/mex.d.ts +2 -0
  37. package/lib/Socket/mex.js +45 -0
  38. package/lib/Socket/newsletter.d.ts +76 -64
  39. package/lib/Socket/newsletter.js +184 -1
  40. package/lib/Socket/socket.d.ts +19 -13
  41. package/lib/Socket/socket.js +805 -1
  42. package/lib/Types/Auth.d.ts +4 -10
  43. package/lib/Types/Bussines.d.ts +24 -0
  44. package/lib/Types/Bussines.js +2 -0
  45. package/lib/Types/Call.d.ts +1 -1
  46. package/lib/Types/Chat.d.ts +29 -9
  47. package/lib/Types/Chat.js +7 -1
  48. package/lib/Types/Contact.d.ts +5 -1
  49. package/lib/Types/Events.d.ts +55 -14
  50. package/lib/Types/GroupMetadata.d.ts +15 -5
  51. package/lib/Types/Label.d.ts +11 -0
  52. package/lib/Types/Label.js +1 -1
  53. package/lib/Types/LabelAssociation.js +1 -1
  54. package/lib/Types/Message.d.ts +75 -49
  55. package/lib/Types/Message.js +10 -7
  56. package/lib/Types/Newsletter.d.ts +129 -98
  57. package/lib/Types/Newsletter.js +33 -38
  58. package/lib/Types/Product.d.ts +1 -1
  59. package/lib/Types/Signal.d.ts +29 -1
  60. package/lib/Types/Socket.d.ts +48 -22
  61. package/lib/Types/State.d.ts +13 -2
  62. package/lib/Types/State.js +12 -0
  63. package/lib/Types/USync.d.ts +1 -1
  64. package/lib/Types/index.d.ts +10 -3
  65. package/lib/Types/index.js +2 -2
  66. package/lib/Utils/auth-utils.d.ts +3 -3
  67. package/lib/Utils/auth-utils.js +378 -102
  68. package/lib/Utils/baileys-event-stream.js +1 -1
  69. package/lib/Utils/business.d.ts +2 -2
  70. package/lib/Utils/business.js +19 -13
  71. package/lib/Utils/chat-utils.d.ts +21 -22
  72. package/lib/Utils/chat-utils.js +201 -154
  73. package/lib/Utils/crypto.d.ts +18 -19
  74. package/lib/Utils/crypto.js +78 -37
  75. package/lib/Utils/decode-wa-message.d.ts +34 -7
  76. package/lib/Utils/decode-wa-message.js +138 -66
  77. package/lib/Utils/event-buffer.d.ts +6 -8
  78. package/lib/Utils/event-buffer.js +81 -43
  79. package/lib/Utils/generics.d.ts +27 -27
  80. package/lib/Utils/generics.js +128 -133
  81. package/lib/Utils/history.d.ts +9 -5
  82. package/lib/Utils/history.js +17 -23
  83. package/lib/Utils/index.d.ts +2 -0
  84. package/lib/Utils/index.js +2 -0
  85. package/lib/Utils/lidToJid-test.d.ts +11 -0
  86. package/lib/Utils/lidToJid-test.js +27 -0
  87. package/lib/Utils/link-preview.d.ts +4 -4
  88. package/lib/Utils/link-preview.js +40 -12
  89. package/lib/Utils/logger.d.ts +11 -3
  90. package/lib/Utils/lt-hash.d.ts +8 -8
  91. package/lib/Utils/lt-hash.js +23 -24
  92. package/lib/Utils/make-mutex.d.ts +2 -2
  93. package/lib/Utils/make-mutex.js +3 -2
  94. package/lib/Utils/message-retry-manager.d.ts +81 -0
  95. package/lib/Utils/message-retry-manager.js +152 -0
  96. package/lib/Utils/messages-media.d.ts +37 -41
  97. package/lib/Utils/messages-media.js +252 -368
  98. package/lib/Utils/messages.d.ts +13 -15
  99. package/lib/Utils/messages.js +274 -261
  100. package/lib/Utils/noise-handler.d.ts +13 -15
  101. package/lib/Utils/noise-handler.js +20 -26
  102. package/lib/Utils/process-message.d.ts +9 -8
  103. package/lib/Utils/process-message.js +157 -93
  104. package/lib/Utils/signal.d.ts +6 -5
  105. package/lib/Utils/signal.js +37 -29
  106. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
  107. package/lib/Utils/use-multi-file-auth-state.js +12 -7
  108. package/lib/Utils/validate-connection.d.ts +5 -6
  109. package/lib/Utils/validate-connection.js +39 -97
  110. package/lib/WABinary/constants.d.ts +24 -27
  111. package/lib/WABinary/constants.js +1276 -13
  112. package/lib/WABinary/decode.d.ts +3 -4
  113. package/lib/WABinary/decode.js +28 -14
  114. package/lib/WABinary/encode.d.ts +1 -2
  115. package/lib/WABinary/encode.js +134 -147
  116. package/lib/WABinary/generic-utils.d.ts +4 -7
  117. package/lib/WABinary/generic-utils.js +40 -125
  118. package/lib/WABinary/jid-utils.d.ts +13 -8
  119. package/lib/WABinary/jid-utils.js +27 -16
  120. package/lib/WAM/BinaryInfo.d.ts +2 -11
  121. package/lib/WAM/constants.d.ts +3 -2
  122. package/lib/WAM/constants.js +2252 -2359
  123. package/lib/WAM/encode.d.ts +1 -2
  124. package/lib/WAM/encode.js +8 -11
  125. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +2 -2
  126. package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -4
  127. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
  128. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +5 -5
  129. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
  130. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +5 -5
  131. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
  132. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +5 -6
  133. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +2 -2
  134. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -1
  135. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +4 -3
  136. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +11 -3
  137. package/lib/WAUSync/USyncQuery.d.ts +2 -2
  138. package/lib/WAUSync/USyncQuery.js +19 -15
  139. package/lib/WAUSync/USyncUser.d.ts +5 -5
  140. package/lib/WAUSync/index.d.ts +1 -1
  141. package/lib/WAUSync/index.js +1 -1
  142. package/package.json +102 -102
  143. package/lib/Defaults/baileys-version.json +0 -3
  144. package/lib/Defaults/phonenumber-mcc.json +0 -223
  145. package/lib/Signal/Group/queue-job.d.ts +0 -1
  146. package/lib/Signal/Group/queue-job.js +0 -57
  147. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  148. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  149. package/lib/Socket/hbmods.d.ts +0 -253
  150. package/lib/Socket/hbmods.js +0 -1
  151. package/lib/Socket/registration.d.ts +0 -267
  152. package/lib/Socket/registration.js +0 -166
  153. package/lib/Socket/usync.d.ts +0 -36
  154. package/lib/Socket/usync.js +0 -70
  155. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -1,223 +0,0 @@
1
- {
2
- "93": 412,
3
- "355": 276,
4
- "213": 603,
5
- "1-684": 544,
6
- "376": 213,
7
- "244": 631,
8
- "1-264": 365,
9
- "1-268": 344,
10
- "54": 722,
11
- "374": 283,
12
- "297": 363,
13
- "61": 505,
14
- "43": 232,
15
- "994": 400,
16
- "1-242": 364,
17
- "973": 426,
18
- "880": 470,
19
- "1-246": 342,
20
- "375": 257,
21
- "32": 206,
22
- "501": 702,
23
- "229": 616,
24
- "1-441": 350,
25
- "975": 402,
26
- "591": 736,
27
- "387": 218,
28
- "267": 652,
29
- "55": 724,
30
- "1-284": 348,
31
- "673": 528,
32
- "359": 284,
33
- "226": 613,
34
- "257": 642,
35
- "855": 456,
36
- "237": 624,
37
- "238": 625,
38
- "1-345": 346,
39
- "236": 623,
40
- "235": 622,
41
- "56": 730,
42
- "86": 454,
43
- "57": 732,
44
- "269": 654,
45
- "682": 548,
46
- "506": 712,
47
- "385": 219,
48
- "53": 368,
49
- "357": 280,
50
- "420": 230,
51
- "243": 630,
52
- "45": 238,
53
- "253": 638,
54
- "1-767": 366,
55
- "1-809": 370,
56
- "1-849": 370,
57
- "1-829": 370,
58
- "593": 740,
59
- "20": 602,
60
- "503": 706,
61
- "240": 627,
62
- "291": 657,
63
- "372": 248,
64
- "251": 636,
65
- "500": 750,
66
- "298": 288,
67
- "679": 542,
68
- "358": 244,
69
- "33": 208,
70
- "689": 547,
71
- "241": 628,
72
- "220": 607,
73
- "995": 282,
74
- "49": 262,
75
- "233": 620,
76
- "350": 266,
77
- "30": 202,
78
- "299": 290,
79
- "1-473": 352,
80
- "1-671": 535,
81
- "502": 704,
82
- "224": 537,
83
- "592": 738,
84
- "509": 372,
85
- "504": 708,
86
- "852": 454,
87
- "36": 216,
88
- "354": 274,
89
- "91": 404,
90
- "62": 510,
91
- "98": 432,
92
- "964": 418,
93
- "353": 234,
94
- "972": 425,
95
- "39": 222,
96
- "225": 612,
97
- "1-876": 338,
98
- "81": 440,
99
- "962": 416,
100
- "254": 639,
101
- "686": 545,
102
- "383": 221,
103
- "965": 419,
104
- "371": 247,
105
- "961": 415,
106
- "266": 651,
107
- "231": 618,
108
- "218": 606,
109
- "423": 295,
110
- "370": 246,
111
- "352": 270,
112
- "389": 294,
113
- "261": 646,
114
- "265": 650,
115
- "60": 502,
116
- "960": 472,
117
- "223": 610,
118
- "356": 278,
119
- "692": 551,
120
- "222": 609,
121
- "230": 617,
122
- "52": 334,
123
- "691": 550,
124
- "373": 259,
125
- "377": 212,
126
- "976": 428,
127
- "382": 297,
128
- "1-664": 354,
129
- "212": 604,
130
- "258": 643,
131
- "95": 414,
132
- "264": 649,
133
- "674": 536,
134
- "977": 429,
135
- "31": 204,
136
- "687": 546,
137
- "64": 530,
138
- "505": 710,
139
- "227": 614,
140
- "234": 621,
141
- "683": 555,
142
- "1-670": 534,
143
- "47": 242,
144
- "968": 226,
145
- "92": 410,
146
- "680": 552,
147
- "970": 423,
148
- "507": 714,
149
- "675": 537,
150
- "595": 744,
151
- "51": 716,
152
- "63": 515,
153
- "48": 260,
154
- "351": 268,
155
- "1-787, 1-939": 330,
156
- "974": 427,
157
- "242": 630,
158
- "40": 226,
159
- "7": 250,
160
- "250": 635,
161
- "290": 658,
162
- "1-869": 356,
163
- "1-758": 358,
164
- "508": 308,
165
- "1-784": 360,
166
- "685": 544,
167
- "378": 292,
168
- "239": 626,
169
- "966": 420,
170
- "221": 608,
171
- "381": 220,
172
- "248": 633,
173
- "232": 619,
174
- "65": 525,
175
- "386": 293,
176
- "677": 540,
177
- "27": 655,
178
- "211": 659,
179
- "34": 214,
180
- "94": 413,
181
- "249": 634,
182
- "597": 746,
183
- "268": 653,
184
- "46": 240,
185
- "41": 228,
186
- "963": 417,
187
- "886": 466,
188
- "992": 436,
189
- "255": 640,
190
- "66": 520,
191
- "228": 615,
192
- "690": 554,
193
- "676": 539,
194
- "1-868": 374,
195
- "216": 605,
196
- "90": 286,
197
- "993": 438,
198
- "1-649": 376,
199
- "688": 553,
200
- "1-340": 332,
201
- "256": 641,
202
- "380": 255,
203
- "971": 424,
204
- "44": 234,
205
- "1": 310,
206
- "598": 748,
207
- "998": 434,
208
- "678": 541,
209
- "379": 225,
210
- "58": 734,
211
- "681": 543,
212
- "967": 421,
213
- "260": 645,
214
- "263": 648,
215
- "670": 514,
216
- "245": 632,
217
- "856": 457,
218
- "599": 362,
219
- "850": 467,
220
- "262": 647,
221
- "82": 450,
222
- "84": 452
223
- }
@@ -1 +0,0 @@
1
- export default function queueJob<T>(bucket: string | number, awaitable: () => Promise<T>): Promise<T>;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = queueJob;
4
- const _queueAsyncBuckets = new Map();
5
- const _gcLimit = 10000;
6
- async function _asyncQueueExecutor(queue, cleanup) {
7
- let offt = 0;
8
- // eslint-disable-next-line no-constant-condition
9
- while (true) {
10
- const limit = Math.min(queue.length, _gcLimit);
11
- for (let i = offt; i < limit; i++) {
12
- const job = queue[i];
13
- try {
14
- job.resolve(await job.awaitable());
15
- }
16
- catch (e) {
17
- job.reject(e);
18
- }
19
- }
20
- if (limit < queue.length) {
21
- if (limit >= _gcLimit) {
22
- queue.splice(0, limit);
23
- offt = 0;
24
- }
25
- else {
26
- offt = limit;
27
- }
28
- }
29
- else {
30
- break;
31
- }
32
- }
33
- cleanup();
34
- }
35
- function queueJob(bucket, awaitable) {
36
- // Skip name assignment since it's readonly in strict mode
37
- if (typeof bucket !== 'string') {
38
- console.warn('Unhandled bucket type (for naming):', typeof bucket, bucket);
39
- }
40
- let inactive = false;
41
- if (!_queueAsyncBuckets.has(bucket)) {
42
- _queueAsyncBuckets.set(bucket, []);
43
- inactive = true;
44
- }
45
- const queue = _queueAsyncBuckets.get(bucket);
46
- const job = new Promise((resolve, reject) => {
47
- queue.push({
48
- awaitable,
49
- resolve: resolve,
50
- reject
51
- });
52
- });
53
- if (inactive) {
54
- _asyncQueueExecutor(queue, () => _queueAsyncBuckets.delete(bucket));
55
- }
56
- return job;
57
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="node" />
2
- import { Socket } from 'net';
3
- import { AbstractSocketClient } from './abstract-socket-client';
4
- export declare class MobileSocketClient extends AbstractSocketClient {
5
- protected socket: Socket | null;
6
- get isOpen(): boolean;
7
- get isClosed(): boolean;
8
- get isClosing(): boolean;
9
- get isConnecting(): boolean;
10
- connect(): Promise<void>;
11
- close(): Promise<void>;
12
- send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
13
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MobileSocketClient = void 0;
4
- const net_1 = require("net");
5
- const abstract_socket_client_1 = require("./abstract-socket-client");
6
- class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
7
- constructor() {
8
- super(...arguments);
9
- this.socket = null;
10
- }
11
- get isOpen() {
12
- var _a;
13
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
14
- }
15
- get isClosed() {
16
- var _a;
17
- return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
18
- }
19
- get isClosing() {
20
- var _a;
21
- return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
22
- }
23
- get isConnecting() {
24
- var _a;
25
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
26
- }
27
- async connect() {
28
- var _a;
29
- if (this.socket) {
30
- return;
31
- }
32
- if (this.config.agent) {
33
- throw new Error('There are not support for proxy agent for mobile connection');
34
- }
35
- else {
36
- this.socket = (0, net_1.connect)({
37
- host: this.url.hostname,
38
- port: Number(this.url.port) || 443
39
- });
40
- }
41
- this.socket.setMaxListeners(0);
42
- const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
43
- for (const event of events) {
44
- (_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
45
- }
46
- this.socket.on('data', (...args) => this.emit('message', ...args));
47
- this.socket.on('ready', (...args) => this.emit('open', ...args));
48
- }
49
- async close() {
50
- if (!this.socket) {
51
- return;
52
- }
53
- return new Promise(resolve => {
54
- this.socket.end(resolve);
55
- this.socket = null;
56
- });
57
- }
58
- send(str, cb) {
59
- if (this.socket === null) {
60
- return false;
61
- }
62
- return this.socket.write(str, undefined, cb);
63
- }
64
- }
65
- exports.MobileSocketClient = MobileSocketClient;
@@ -1,253 +0,0 @@
1
- import { proto } from '../../WAProto';
2
-
3
- declare namespace hbmodsofc {
4
- interface MediaUploadOptions {
5
- fileEncSha256?: Buffer;
6
- mediaType?: string;
7
- newsletter?: boolean;
8
- }
9
-
10
- type WAMediaUploadFunction = (
11
- stream: Buffer | NodeJS.ReadableStream,
12
- options?: MediaUploadOptions
13
- ) => Promise<{ url: string; directPath: string }>;
14
-
15
- interface WAMessageContentGenerationOptions {
16
- upload?: WAMediaUploadFunction;
17
- mediaCache?: any;
18
- options?: any;
19
- logger?: any;
20
- }
21
-
22
- interface StickerMessage {
23
- url: string;
24
- fileSha256: Buffer | string;
25
- fileEncSha256: Buffer | string;
26
- mediaKey: Buffer | string;
27
- mimetype: string;
28
- directPath: string;
29
- fileLength: number | string;
30
- mediaKeyTimestamp: number | string;
31
- isAnimated?: boolean;
32
- stickerSentTs?: number | string;
33
- isAvatar?: boolean;
34
- isAiSticker?: boolean;
35
- isLottie?: boolean;
36
- }
37
-
38
- interface PaymentMessage {
39
- amount: number;
40
- currency?: string;
41
- from?: string;
42
- expiry?: number;
43
- sticker?: { stickerMessage: StickerMessage };
44
- note?: string;
45
- background?: {
46
- id?: string;
47
- fileLength?: string;
48
- width?: number;
49
- height?: number;
50
- mimetype?: string;
51
- placeholderArgb?: number;
52
- textArgb?: number;
53
- subtextArgb?: number;
54
- };
55
- }
56
-
57
- interface ProductMessage {
58
- title: string;
59
- description: string;
60
- thumbnail: Buffer | { url: string };
61
- productId: string;
62
- retailerId: string;
63
- url: string;
64
- body?: string;
65
- footer?: string;
66
- buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
67
- priceAmount1000?: number | null;
68
- currencyCode?: string;
69
- }
70
-
71
- interface InteractiveMessage {
72
- header?: string;
73
- title: string;
74
- footer?: string;
75
- thumbnail?: string;
76
- image?: string | Buffer | { url: string };
77
- video?: string | Buffer | { url: string };
78
- document?: string | Buffer | { url: string };
79
- mimetype?: string;
80
- fileName?: string;
81
- jpegThumbnail?: string | Buffer | { url: string };
82
- contextInfo?: {
83
- mentionedJid?: string[];
84
- forwardingScore?: number;
85
- isForwarded?: boolean;
86
- externalAdReply?: {
87
- title?: string;
88
- body?: string;
89
- mediaType?: number;
90
- thumbnailUrl?: string;
91
- mediaUrl?: string;
92
- sourceUrl?: string;
93
- showAdAttribution?: boolean;
94
- renderLargerThumbnail?: boolean;
95
- [key: string]: any;
96
- };
97
- [key: string]: any;
98
- };
99
- externalAdReply?: {
100
- title?: string;
101
- body?: string;
102
- mediaType?: number;
103
- thumbnailUrl?: string;
104
- mediaUrl?: string;
105
- sourceUrl?: string;
106
- showAdAttribution?: boolean;
107
- renderLargerThumbnail?: boolean;
108
- [key: string]: any;
109
- };
110
- buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
111
- nativeFlowMessage?: {
112
- messageParamsJson?: string;
113
- buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
114
- [key: string]: any;
115
- };
116
- }
117
-
118
- interface AlbumItem {
119
- image?: string | Buffer | { url: string; caption?: string };
120
- video?: string | Buffer | { url: string; caption?: string };
121
- }
122
-
123
- interface EventMessageLocation {
124
- degreesLatitude: number;
125
- degreesLongitude: number;
126
- name: string;
127
- }
128
-
129
- interface EventMessage {
130
- isCanceled?: boolean;
131
- name: string;
132
- description: string;
133
- location?: EventMessageLocation;
134
- joinLink?: string;
135
- startTime?: string | number;
136
- endTime?: string | number;
137
- extraGuestsAllowed?: boolean;
138
- }
139
-
140
- interface PollVote {
141
- optionName: string;
142
- optionVoteCount: string | number;
143
- }
144
-
145
- interface PollResultMessage {
146
- name: string;
147
- pollVotes: PollVote[];
148
- }
149
-
150
- interface GroupStatusMessage {
151
- message?: any;
152
- image?: string | Buffer | { url: string };
153
- video?: string | Buffer | { url: string };
154
- text?: string;
155
- caption?: string;
156
- document?: string | Buffer | { url: string };
157
- [key: string]: any;
158
- }
159
-
160
- interface MessageContent {
161
- requestPaymentMessage?: PaymentMessage;
162
- productMessage?: ProductMessage;
163
- interactiveMessage?: InteractiveMessage;
164
- albumMessage?: AlbumItem[];
165
- eventMessage?: EventMessage;
166
- pollResultMessage?: PollResultMessage;
167
- groupStatusMessage?: GroupStatusMessage;
168
- sender?: string;
169
- }
170
-
171
- interface MessageOptions {
172
- quoted?: proto.IWebMessageInfo;
173
- filter?: boolean;
174
- }
175
-
176
- interface Utils {
177
- prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
178
- generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
179
- generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
180
- generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
181
- generateMessageID: () => string;
182
- prepareMessageContent?: (content: any, options?: any) => Promise<any>;
183
- }
184
-
185
- interface BailUtils {
186
- generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
187
- generateMessageID: () => string;
188
- getContentType: (msg: any) => string;
189
- }
190
- }
191
-
192
- declare class hbmodsofc {
193
- constructor(
194
- utils: hbmodsofc.Utils,
195
- waUploadToServer: hbmodsofc.WAMediaUploadFunction,
196
- relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
197
- );
198
-
199
- detectType(content: hbmodsofc.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
200
-
201
- handlePayment(
202
- content: { requestPaymentMessage: hbmodsofc.PaymentMessage },
203
- quoted?: proto.IWebMessageInfo
204
- ): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
205
-
206
- handleProduct(
207
- content: { productMessage: hbmodsofc.ProductMessage },
208
- jid: string,
209
- quoted?: proto.IWebMessageInfo
210
- ): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
211
-
212
- handleInteractive(
213
- content: { interactiveMessage: hbmodsofc.InteractiveMessage },
214
- jid: string,
215
- quoted?: proto.IWebMessageInfo
216
- ): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
217
-
218
- handleAlbum(
219
- content: { albumMessage: hbmodsofc.AlbumItem[] },
220
- jid: string,
221
- quoted?: proto.IWebMessageInfo
222
- ): Promise<any>;
223
-
224
- handleEvent(
225
- content: { eventMessage: hbmodsofc.EventMessage },
226
- jid: string,
227
- quoted?: proto.IWebMessageInfo
228
- ): Promise<any>;
229
-
230
- handlePollResult(
231
- content: { pollResultMessage: hbmodsofc.PollResultMessage },
232
- jid: string,
233
- quoted?: proto.IWebMessageInfo
234
- ): Promise<any>;
235
-
236
- handleGroupStory(
237
- content: { groupStatusMessage: hbmodsofc.GroupStatusMessage },
238
- jid: string,
239
- quoted?: proto.IWebMessageInfo
240
- ): Promise<any>;
241
-
242
- buildMessageContent(
243
- content: any,
244
- opts?: hbmodsofc.WAMessageContentGenerationOptions
245
- ): Promise<any>;
246
-
247
- utils: hbmodsofc.Utils;
248
- relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
249
- waUploadToServer: hbmodsofc.WAMediaUploadFunction;
250
- bail: hbmodsofc.BailUtils;
251
- }
252
-
253
- export = hbmodsofc;