alipclutch-baileys 8.4.1 → 8.5.2

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.
@@ -1,43 +1,270 @@
1
- import { Boom } from '@hapi/boom';
2
- import { SocketConfig } from '../Types';
3
- import { BinaryNode } from '../WABinary';
4
- import { WebSocketClient } from './Client';
5
- /**
6
- * Connects to WA servers and performs:
7
- * - simple queries (no retry mechanism, wait for connection establishment)
8
- * - listen to messages and emit events
9
- * - query phone connection
10
- */
11
- export declare const makeSocket: (config: SocketConfig) => {
12
- type: "md";
13
- ws: WebSocketClient;
14
- ev: import("../Types").BaileysEventEmitter & {
15
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
16
- buffer(): void;
17
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
18
- flush(force?: boolean): boolean;
19
- isBuffering(): boolean;
20
- };
21
- authState: {
22
- creds: import("../Types").AuthenticationCreds;
23
- keys: import("../Types").SignalKeyStoreWithTransaction;
24
- };
25
- signalRepository: import("../Types").SignalRepository;
26
- readonly user: import("../Types").Contact | undefined;
27
- generateMessageTag: () => string;
28
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
29
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
30
- waitForSocketOpen: () => Promise<void>;
31
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
32
- sendNode: (frame: BinaryNode) => Promise<void>;
33
- logout: (msg?: string) => Promise<void>;
34
- end: (error: Error | undefined) => void;
35
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
36
- uploadPreKeys: (count?: number) => Promise<void>;
37
- uploadPreKeysToServerIfRequired: () => Promise<void>;
38
- requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
39
- /** Waits for the connection to WA to reach a state */
40
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
41
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
42
- };
43
- export type Socket = ReturnType<typeof makeSocket>;
1
+ // setup.d.ts by alip
2
+ import { proto } from '../../WAProto';
3
+
4
+ declare namespace NotForrAll {
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; mediaKey: Buffer; fileEncSha256: Buffer; fileSha256: Buffer; fileLength: number }>;
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
+ title: string;
74
+ footer?: string;
75
+ thumbnail?: string;
76
+ image?: string | Buffer | { url: string };
77
+ video?: string | Buffer | { url: string };
78
+ document?: Buffer;
79
+ mimetype?: string;
80
+ fileName?: string;
81
+ jpegThumbnail?: Buffer;
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?: { url: string; caption?: string };
120
+ video?: { 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
+ // --- BARU: List Message ---
151
+ interface ListSection {
152
+ title: string;
153
+ rows: ListRow[];
154
+ }
155
+
156
+ interface ListRow {
157
+ rowId: string;
158
+ title: string;
159
+ description?: string;
160
+ }
161
+
162
+ interface ListMessage {
163
+ title: string;
164
+ description: string;
165
+ buttonText: string;
166
+ sections: ListSection[];
167
+ listType?: number;
168
+ contextInfo?: proto.IMessageContextInfo;
169
+ footer?: string;
170
+ }
171
+
172
+ // --- BARU: Group Story ---
173
+ interface GroupStoryMessage {
174
+ image?: Buffer | string | { url: string };
175
+ video?: Buffer | string | { url: string };
176
+ caption?: string;
177
+ mentions?: string[];
178
+ jpegThumbnail?: Buffer;
179
+ }
180
+
181
+ interface MessageContent {
182
+ requestPaymentMessage?: PaymentMessage;
183
+ productMessage?: ProductMessage;
184
+ interactiveMessage?: InteractiveMessage;
185
+ albumMessage?: AlbumItem[];
186
+ eventMessage?: EventMessage;
187
+ pollResultMessage?: PollResultMessage;
188
+ sender?: string;
189
+ listMessage?: ListMessage; // <-- BARU
190
+ groupStoryMessage?: GroupStoryMessage; // <-- BARU
191
+ }
192
+
193
+ interface MessageOptions {
194
+ quoted?: proto.IWebMessageInfo;
195
+ filter?: boolean;
196
+ }
197
+
198
+ interface Utils {
199
+ // Asumsi Utils punya akses ke auth state untuk jid
200
+ auth: { creds: { me: { id: string } } };
201
+ unixTimestampSeconds: () => number; // Fungsi yang umum ada di Utils
202
+ prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
203
+ generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
204
+ generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
205
+ generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
206
+ generateMessageID: () => string;
207
+ // Asumsi Utils punya fungsi WABinary terkait JID
208
+ jidNormalizedUser: (jid: string) => string;
209
+ isJidGroup: (jid: string) => boolean;
210
+ }
211
+ }
212
+
213
+ declare class NotForrAll {
214
+ constructor(
215
+ utils: NotForrAll.Utils,
216
+ waUploadToServer: NotForrAll.WAMediaUploadFunction,
217
+ relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
218
+ );
219
+
220
+ detectType(content: NotForrAll.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'LIST' | 'GROUP_STORY' | null; // <-- Diperbarui
221
+
222
+ handlePayment(
223
+ content: { requestPaymentMessage: NotForrAll.PaymentMessage },
224
+ quoted?: proto.IWebMessageInfo
225
+ ): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
226
+
227
+ handleProduct(
228
+ content: { productMessage: NotForrAll.ProductMessage },
229
+ jid: string,
230
+ quoted?: proto.IWebMessageInfo
231
+ ): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
232
+
233
+ handleInteractive(
234
+ content: { interactiveMessage: NotForrAll.InteractiveMessage },
235
+ jid: string,
236
+ quoted?: proto.IWebMessageInfo
237
+ ): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
238
+
239
+ handleAlbum(
240
+ content: { albumMessage: NotForrAll.AlbumItem[] },
241
+ jid: string,
242
+ quoted?: proto.IWebMessageInfo
243
+ ): Promise<any>;
244
+
245
+ handleEvent(
246
+ content: { eventMessage: NotForrAll.EventMessage },
247
+ jid: string,
248
+ quoted?: proto.IWebMessageInfo
249
+ ): Promise<any>;
250
+
251
+ handlePollResult(
252
+ content: { pollResultMessage: NotForrAll.PollResultMessage },
253
+ jid: string,
254
+ quoted?: proto.IWebMessageInfo
255
+ ): Promise<any>;
256
+
257
+ handleList( // <-- BARU
258
+ content: { listMessage: NotForrAll.ListMessage },
259
+ jid: string,
260
+ quoted?: proto.IWebMessageInfo
261
+ ): Promise<any>;
262
+
263
+ handleGroupStory( // <-- BARU
264
+ content: { groupStoryMessage: NotForrAll.GroupStoryMessage },
265
+ jid: string,
266
+ quoted?: proto.IWebMessageInfo
267
+ ): Promise<any>;
268
+ }
269
+
270
+ export = NotForrAll;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alipclutch-baileys",
3
- "version": "8.4.1",
4
- "description": "kazumarii My Baileys Mod By Alip Clutch",
3
+ "version": "8.5.2",
4
+ "description": "Baileys Mod By Alip Clutch",
5
5
  "keywords": [
6
6
  "baileys",
7
7
  "whatsapp",
@@ -16,7 +16,7 @@
16
16
  "url": "https://www.npmjs.com/package/alipclutch-baileys"
17
17
  },
18
18
  "license": "MIT",
19
- "author": "kazumarii",
19
+ "author": "alipp",
20
20
  "main": "./lib/index.js",
21
21
  "files": [
22
22
  "lib/*",
@@ -97,4 +97,4 @@
97
97
  "engines": {
98
98
  "node": ">=20.0.0"
99
99
  }
100
- }
100
+ }
package/LICENSE DELETED
@@ -1,23 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Kazumarii/Baileys
4
-
5
- With baileys version 6.7.21
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.