@ostyado/baileys 1.1.0 → 1.1.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 (49) hide show
  1. package/README.md +380 -2
  2. package/WAProto/index.js +56886 -17506
  3. package/engine-requirements.js +10 -0
  4. package/lib/Defaults/baileys-version.json +1 -1
  5. package/lib/Defaults/index.js +19 -2
  6. package/lib/Socket/chats.d.ts +215 -32
  7. package/lib/Socket/chats.js +168 -75
  8. package/lib/Socket/dugong.d.ts +254 -0
  9. package/lib/Socket/dugong.js +484 -0
  10. package/lib/Socket/groups.js +18 -18
  11. package/lib/Socket/index.js +1 -0
  12. package/lib/Socket/messages-send.d.ts +2 -2
  13. package/lib/Socket/messages-send.js +323 -348
  14. package/lib/Socket/newsletter.js +136 -21
  15. package/lib/Socket/socket.js +66 -31
  16. package/lib/Types/Newsletter.d.ts +97 -86
  17. package/lib/Types/Newsletter.js +38 -32
  18. package/lib/Utils/generics.js +65 -33
  19. package/lib/Utils/messages-media.js +145 -57
  20. package/lib/Utils/messages.js +24 -44
  21. package/lib/Utils/signal.js +48 -46
  22. package/lib/Utils/use-multi-file-auth-state.js +45 -6
  23. package/lib/Utils/validate-connection.js +89 -65
  24. package/lib/WABinary/constants.d.ts +27 -24
  25. package/lib/WABinary/encode.js +160 -123
  26. package/lib/WABinary/generic-utils.d.ts +2 -1
  27. package/lib/WABinary/generic-utils.js +123 -43
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.js +12 -2
  30. package/package.json +104 -100
  31. package/WAProto/GenerateStatics.sh +0 -4
  32. package/WAProto/WAProto.proto +0 -3344
  33. package/WAProto/index.d.ts +0 -37016
  34. package/WASignalGroup/GroupProtocol.js +0 -1697
  35. package/WASignalGroup/ciphertext_message.js +0 -16
  36. package/WASignalGroup/group_cipher.js +0 -120
  37. package/WASignalGroup/group_session_builder.js +0 -46
  38. package/WASignalGroup/index.js +0 -5
  39. package/WASignalGroup/keyhelper.js +0 -21
  40. package/WASignalGroup/protobufs.js +0 -3
  41. package/WASignalGroup/queue_job.js +0 -69
  42. package/WASignalGroup/sender_chain_key.js +0 -50
  43. package/WASignalGroup/sender_key_distribution_message.js +0 -78
  44. package/WASignalGroup/sender_key_message.js +0 -92
  45. package/WASignalGroup/sender_key_name.js +0 -70
  46. package/WASignalGroup/sender_key_record.js +0 -56
  47. package/WASignalGroup/sender_key_state.js +0 -129
  48. package/WASignalGroup/sender_message_key.js +0 -39
  49. package/lib/Signal/Group/x +0 -1
@@ -0,0 +1,254 @@
1
+ // dugong.d.ts
2
+ import { proto } from '../../WAProto';
3
+
4
+ declare namespace kikyy {
5
+ interface MediaUploadOptions {
6
+ fileEncSha256?: Buffer;
7
+ mediaType?: string;
8
+ newsletter?: boolean;
9
+ }
10
+
11
+ type WAMediaUploadFunction = (
12
+ stream: Buffer | NodeJS.ReadableStream,
13
+ options?: MediaUploadOptions
14
+ ) => Promise<{ url: string; directPath: string }>;
15
+
16
+ interface WAMessageContentGenerationOptions {
17
+ upload?: WAMediaUploadFunction;
18
+ mediaCache?: any;
19
+ options?: any;
20
+ logger?: any;
21
+ }
22
+
23
+ interface StickerMessage {
24
+ url: string;
25
+ fileSha256: Buffer | string;
26
+ fileEncSha256: Buffer | string;
27
+ mediaKey: Buffer | string;
28
+ mimetype: string;
29
+ directPath: string;
30
+ fileLength: number | string;
31
+ mediaKeyTimestamp: number | string;
32
+ isAnimated?: boolean;
33
+ stickerSentTs?: number | string;
34
+ isAvatar?: boolean;
35
+ isAiSticker?: boolean;
36
+ isLottie?: boolean;
37
+ }
38
+
39
+ interface PaymentMessage {
40
+ amount: number;
41
+ currency?: string;
42
+ from?: string;
43
+ expiry?: number;
44
+ sticker?: { stickerMessage: StickerMessage };
45
+ note?: string;
46
+ background?: {
47
+ id?: string;
48
+ fileLength?: string;
49
+ width?: number;
50
+ height?: number;
51
+ mimetype?: string;
52
+ placeholderArgb?: number;
53
+ textArgb?: number;
54
+ subtextArgb?: number;
55
+ };
56
+ }
57
+
58
+ interface ProductMessage {
59
+ title: string;
60
+ description: string;
61
+ thumbnail: Buffer | { url: string };
62
+ productId: string;
63
+ retailerId: string;
64
+ url: string;
65
+ body?: string;
66
+ footer?: string;
67
+ buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
68
+ priceAmount1000?: number | null;
69
+ currencyCode?: string;
70
+ }
71
+
72
+ interface InteractiveMessage {
73
+ header?: string;
74
+ title: string;
75
+ footer?: string;
76
+ thumbnail?: string;
77
+ image?: string | Buffer | { url: string };
78
+ video?: string | Buffer | { url: string };
79
+ document?: string | Buffer | { url: string };
80
+ mimetype?: string;
81
+ fileName?: string;
82
+ jpegThumbnail?: string | Buffer | { url: string };
83
+ contextInfo?: {
84
+ mentionedJid?: string[];
85
+ forwardingScore?: number;
86
+ isForwarded?: boolean;
87
+ externalAdReply?: {
88
+ title?: string;
89
+ body?: string;
90
+ mediaType?: number;
91
+ thumbnailUrl?: string;
92
+ mediaUrl?: string;
93
+ sourceUrl?: string;
94
+ showAdAttribution?: boolean;
95
+ renderLargerThumbnail?: boolean;
96
+ [key: string]: any;
97
+ };
98
+ [key: string]: any;
99
+ };
100
+ externalAdReply?: {
101
+ title?: string;
102
+ body?: string;
103
+ mediaType?: number;
104
+ thumbnailUrl?: string;
105
+ mediaUrl?: string;
106
+ sourceUrl?: string;
107
+ showAdAttribution?: boolean;
108
+ renderLargerThumbnail?: boolean;
109
+ [key: string]: any;
110
+ };
111
+ buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
112
+ nativeFlowMessage?: {
113
+ messageParamsJson?: string;
114
+ buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
115
+ [key: string]: any;
116
+ };
117
+ }
118
+
119
+ interface AlbumItem {
120
+ image?: string | Buffer | { url: string; caption?: string };
121
+ video?: string | Buffer | { url: string; caption?: string };
122
+ }
123
+
124
+ interface EventMessageLocation {
125
+ degreesLatitude: number;
126
+ degreesLongitude: number;
127
+ name: string;
128
+ }
129
+
130
+ interface EventMessage {
131
+ isCanceled?: boolean;
132
+ name: string;
133
+ description: string;
134
+ location?: EventMessageLocation;
135
+ joinLink?: string;
136
+ startTime?: string | number;
137
+ endTime?: string | number;
138
+ extraGuestsAllowed?: boolean;
139
+ }
140
+
141
+ interface PollVote {
142
+ optionName: string;
143
+ optionVoteCount: string | number;
144
+ }
145
+
146
+ interface PollResultMessage {
147
+ name: string;
148
+ pollVotes: PollVote[];
149
+ }
150
+
151
+ interface GroupStatusMessage {
152
+ message?: any;
153
+ image?: string | Buffer | { url: string };
154
+ video?: string | Buffer | { url: string };
155
+ text?: string;
156
+ caption?: string;
157
+ document?: string | Buffer | { url: string };
158
+ [key: string]: any;
159
+ }
160
+
161
+ interface MessageContent {
162
+ requestPaymentMessage?: PaymentMessage;
163
+ productMessage?: ProductMessage;
164
+ interactiveMessage?: InteractiveMessage;
165
+ albumMessage?: AlbumItem[];
166
+ eventMessage?: EventMessage;
167
+ pollResultMessage?: PollResultMessage;
168
+ groupStatusMessage?: GroupStatusMessage;
169
+ sender?: string;
170
+ }
171
+
172
+ interface MessageOptions {
173
+ quoted?: proto.IWebMessageInfo;
174
+ filter?: boolean;
175
+ }
176
+
177
+ interface Utils {
178
+ prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
179
+ generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
180
+ generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
181
+ generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
182
+ generateMessageID: () => string;
183
+ prepareMessageContent?: (content: any, options?: any) => Promise<any>;
184
+ }
185
+
186
+ interface BailUtils {
187
+ generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
188
+ generateMessageID: () => string;
189
+ getContentType: (msg: any) => string;
190
+ }
191
+ }
192
+
193
+ declare class kikyy {
194
+ constructor(
195
+ utils: kikyy.Utils,
196
+ waUploadToServer: kikyy.WAMediaUploadFunction,
197
+ relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
198
+ );
199
+
200
+ detectType(content: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
201
+
202
+ handlePayment(
203
+ content: { requestPaymentMessage: kikyy.PaymentMessage },
204
+ quoted?: proto.IWebMessageInfo
205
+ ): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
206
+
207
+ handleProduct(
208
+ content: { productMessage: kikyy.ProductMessage },
209
+ jid: string,
210
+ quoted?: proto.IWebMessageInfo
211
+ ): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
212
+
213
+ handleInteractive(
214
+ content: { interactiveMessage: kikyy.InteractiveMessage },
215
+ jid: string,
216
+ quoted?: proto.IWebMessageInfo
217
+ ): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
218
+
219
+ handleAlbum(
220
+ content: { albumMessage: kikyy.AlbumItem[] },
221
+ jid: string,
222
+ quoted?: proto.IWebMessageInfo
223
+ ): Promise<any>;
224
+
225
+ handleEvent(
226
+ content: { eventMessage: kikyy.EventMessage },
227
+ jid: string,
228
+ quoted?: proto.IWebMessageInfo
229
+ ): Promise<any>;
230
+
231
+ handlePollResult(
232
+ content: { pollResultMessage: kikyy.PollResultMessage },
233
+ jid: string,
234
+ quoted?: proto.IWebMessageInfo
235
+ ): Promise<any>;
236
+
237
+ handleGroupStory(
238
+ content: { groupStatusMessage: kikyy.GroupStatusMessage },
239
+ jid: string,
240
+ quoted?: proto.IWebMessageInfo
241
+ ): Promise<any>;
242
+
243
+ buildMessageContent(
244
+ content: any,
245
+ opts?: kikyy.WAMessageContentGenerationOptions
246
+ ): Promise<any>;
247
+
248
+ utils: kikyy.Utils;
249
+ relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
250
+ waUploadToServer: kikyy.WAMediaUploadFunction;
251
+ bail: kikyy.BailUtils;
252
+ }
253
+
254
+ export = kikyy;