zenvy-baileys 8.6.47 → 8.6.49
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/lib/Socket/messages-send.js +2 -2
- package/lib/Socket/zenvybail.d.ts +266 -0
- package/lib/Socket/zenvybail.js +580 -0
- package/lib/Socket/zenvyclutch.d.ts +266 -0
- package/lib/Socket/zenvyclutch.js +580 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ const link_preview_1 = require("../Utils/link-preview");
|
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
16
|
const newsletter_1 = require("./newsletter");
|
|
17
17
|
const WAUSync_1 = require("../WAUSync")
|
|
18
|
-
const
|
|
18
|
+
const zenvy = require('./zenvybail');
|
|
19
19
|
var ListType = WAProto_1.proto.Message.ListMessage.ListType;
|
|
20
20
|
const makeMessagesSocket = (config) => {
|
|
21
21
|
const {
|
|
@@ -697,7 +697,7 @@ const makeMessagesSocket = (config) => {
|
|
|
697
697
|
return result;
|
|
698
698
|
}
|
|
699
699
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
700
|
-
const rahmi = new
|
|
700
|
+
const rahmi = new zenvy(Utils_1, waUploadToServer, relayMessage);
|
|
701
701
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
702
702
|
return {
|
|
703
703
|
...sock,
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { proto } from '../../WAProto';
|
|
2
|
+
|
|
3
|
+
declare namespace zenvy {
|
|
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
|
+
interface StickerPack {
|
|
38
|
+
stickers: (Buffer | { data: Buffer })[];
|
|
39
|
+
cover: Buffer;
|
|
40
|
+
name: string;
|
|
41
|
+
publisher: string;
|
|
42
|
+
packId?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface PaymentMessage {
|
|
46
|
+
amount: number;
|
|
47
|
+
currency?: string;
|
|
48
|
+
from?: string;
|
|
49
|
+
expiry?: number;
|
|
50
|
+
sticker?: { stickerMessage: StickerMessage };
|
|
51
|
+
note?: string;
|
|
52
|
+
background?: {
|
|
53
|
+
id?: string;
|
|
54
|
+
fileLength?: string;
|
|
55
|
+
width?: number;
|
|
56
|
+
height?: number;
|
|
57
|
+
mimetype?: string;
|
|
58
|
+
placeholderArgb?: number;
|
|
59
|
+
textArgb?: number;
|
|
60
|
+
subtextArgb?: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface ProductMessage {
|
|
65
|
+
title: string;
|
|
66
|
+
description: string;
|
|
67
|
+
thumbnail: Buffer | { url: string };
|
|
68
|
+
productId: string;
|
|
69
|
+
retailerId: string;
|
|
70
|
+
url: string;
|
|
71
|
+
body?: string;
|
|
72
|
+
footer?: string;
|
|
73
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
74
|
+
priceAmount1000?: number | null;
|
|
75
|
+
currencyCode?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface InteractiveMessage {
|
|
79
|
+
header?: string;
|
|
80
|
+
title: string;
|
|
81
|
+
footer?: string;
|
|
82
|
+
thumbnail?: string;
|
|
83
|
+
image?: string | Buffer | { url: string };
|
|
84
|
+
video?: string | Buffer | { url: string };
|
|
85
|
+
document?: string | Buffer | { url: string };
|
|
86
|
+
mimetype?: string;
|
|
87
|
+
fileName?: string;
|
|
88
|
+
jpegThumbnail?: string | Buffer | { url: string };
|
|
89
|
+
contextInfo?: {
|
|
90
|
+
mentionedJid?: string[];
|
|
91
|
+
forwardingScore?: number;
|
|
92
|
+
isForwarded?: boolean;
|
|
93
|
+
externalAdReply?: {
|
|
94
|
+
title?: string;
|
|
95
|
+
body?: string;
|
|
96
|
+
mediaType?: number;
|
|
97
|
+
thumbnailUrl?: string;
|
|
98
|
+
mediaUrl?: string;
|
|
99
|
+
sourceUrl?: string;
|
|
100
|
+
showAdAttribution?: boolean;
|
|
101
|
+
renderLargerThumbnail?: boolean;
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
};
|
|
104
|
+
[key: string]: any;
|
|
105
|
+
};
|
|
106
|
+
externalAdReply?: {
|
|
107
|
+
title?: string;
|
|
108
|
+
body?: string;
|
|
109
|
+
mediaType?: number;
|
|
110
|
+
thumbnailUrl?: string;
|
|
111
|
+
mediaUrl?: string;
|
|
112
|
+
sourceUrl?: string;
|
|
113
|
+
showAdAttribution?: boolean;
|
|
114
|
+
renderLargerThumbnail?: boolean;
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
};
|
|
117
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
118
|
+
nativeFlowMessage?: {
|
|
119
|
+
messageParamsJson?: string;
|
|
120
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
121
|
+
[key: string]: any;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface AlbumItem {
|
|
126
|
+
image?: string | Buffer | { url: string; caption?: string };
|
|
127
|
+
video?: string | Buffer | { url: string; caption?: string };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface EventMessageLocation {
|
|
131
|
+
degreesLatitude: number;
|
|
132
|
+
degreesLongitude: number;
|
|
133
|
+
name: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface EventMessage {
|
|
137
|
+
isCanceled?: boolean;
|
|
138
|
+
name: string;
|
|
139
|
+
description: string;
|
|
140
|
+
location?: EventMessageLocation;
|
|
141
|
+
joinLink?: string;
|
|
142
|
+
startTime?: string | number;
|
|
143
|
+
endTime?: string | number;
|
|
144
|
+
extraGuestsAllowed?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface PollVote {
|
|
148
|
+
optionName: string;
|
|
149
|
+
optionVoteCount: string | number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface PollResultMessage {
|
|
153
|
+
name: string;
|
|
154
|
+
pollVotes: PollVote[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface GroupStatusMessage {
|
|
158
|
+
message?: any;
|
|
159
|
+
image?: string | Buffer | { url: string };
|
|
160
|
+
video?: string | Buffer | { url: string };
|
|
161
|
+
text?: string;
|
|
162
|
+
caption?: string;
|
|
163
|
+
document?: string | Buffer | { url: string };
|
|
164
|
+
[key: string]: any;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface MessageContent {
|
|
168
|
+
requestPaymentMessage?: PaymentMessage;
|
|
169
|
+
productMessage?: ProductMessage;
|
|
170
|
+
interactiveMessage?: InteractiveMessage;
|
|
171
|
+
albumMessage?: AlbumItem[];
|
|
172
|
+
eventMessage?: EventMessage;
|
|
173
|
+
pollResultMessage?: PollResultMessage;
|
|
174
|
+
groupStatusMessage?: GroupStatusMessage;
|
|
175
|
+
stickerPack?: StickerPack; // <--- Tambah ini
|
|
176
|
+
sender?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
interface MessageOptions {
|
|
181
|
+
quoted?: proto.IWebMessageInfo;
|
|
182
|
+
filter?: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface Utils {
|
|
186
|
+
prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
187
|
+
generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
188
|
+
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
189
|
+
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
190
|
+
generateMessageID: () => string;
|
|
191
|
+
prepareMessageContent?: (content: any, options?: any) => Promise<any>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface BailUtils {
|
|
195
|
+
generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
196
|
+
generateMessageID: () => string;
|
|
197
|
+
getContentType: (msg: any) => string;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare class zenvy {
|
|
202
|
+
constructor(
|
|
203
|
+
utils: zenvy.Utils,
|
|
204
|
+
waUploadToServer: zenvy.WAMediaUploadFunction,
|
|
205
|
+
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
detectType(content: zenvy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | 'STICKER_PACK' | null;
|
|
209
|
+
|
|
210
|
+
handlePayment(
|
|
211
|
+
content: { requestPaymentMessage: zenvy.PaymentMessage },
|
|
212
|
+
quoted?: proto.IWebMessageInfo
|
|
213
|
+
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
214
|
+
handleStickerPack(
|
|
215
|
+
content: { stickerPack: zenvy.StickerPack },
|
|
216
|
+
jid: string,
|
|
217
|
+
quoted?: proto.IWebMessageInfo
|
|
218
|
+
): Promise<{ stickerPackMessage: any }>;
|
|
219
|
+
handleProduct(
|
|
220
|
+
content: { productMessage: zenvy.ProductMessage },
|
|
221
|
+
jid: string,
|
|
222
|
+
quoted?: proto.IWebMessageInfo
|
|
223
|
+
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
224
|
+
|
|
225
|
+
handleInteractive(
|
|
226
|
+
content: { interactiveMessage: zenvy.InteractiveMessage },
|
|
227
|
+
jid: string,
|
|
228
|
+
quoted?: proto.IWebMessageInfo
|
|
229
|
+
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
230
|
+
|
|
231
|
+
handleAlbum(
|
|
232
|
+
content: { albumMessage: zenvy.AlbumItem[] },
|
|
233
|
+
jid: string,
|
|
234
|
+
quoted?: proto.IWebMessageInfo
|
|
235
|
+
): Promise<any>;
|
|
236
|
+
|
|
237
|
+
handleEvent(
|
|
238
|
+
content: { eventMessage: zenvy.EventMessage },
|
|
239
|
+
jid: string,
|
|
240
|
+
quoted?: proto.IWebMessageInfo
|
|
241
|
+
): Promise<any>;
|
|
242
|
+
|
|
243
|
+
handlePollResult(
|
|
244
|
+
content: { pollResultMessage: zenvy.PollResultMessage },
|
|
245
|
+
jid: string,
|
|
246
|
+
quoted?: proto.IWebMessageInfo
|
|
247
|
+
): Promise<any>;
|
|
248
|
+
|
|
249
|
+
handleGroupStory(
|
|
250
|
+
content: { groupStatusMessage: zenvy.GroupStatusMessage },
|
|
251
|
+
jid: string,
|
|
252
|
+
quoted?: proto.IWebMessageInfo
|
|
253
|
+
): Promise<any>;
|
|
254
|
+
|
|
255
|
+
buildMessageContent(
|
|
256
|
+
content: any,
|
|
257
|
+
opts?: zenvy.WAMessageContentGenerationOptions
|
|
258
|
+
): Promise<any>;
|
|
259
|
+
|
|
260
|
+
utils: zenvy.Utils;
|
|
261
|
+
relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
262
|
+
waUploadToServer: zenvy.WAMediaUploadFunction;
|
|
263
|
+
bail: zenvy.BailUtils;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export = zenvy;
|