@lennyyaawa/lannysecx 9.9.18
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/README.md +61 -0
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +3344 -0
- package/WAProto/index.d.ts +37016 -0
- package/WAProto/index.js +130281 -0
- package/lib/Database/mongoAdapter.js +77 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +53 -0
- package/lib/Defaults/index.js +130 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts +14 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.d.ts +10 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.d.ts +17 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.d.ts +30 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.d.ts +38 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +29 -0
- package/lib/Signal/libsignal.d.ts +3 -0
- package/lib/Signal/libsignal.js +174 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +19 -0
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/web-socket-client.d.ts +12 -0
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/PaxHeaders.0/swzesty st 1963.d.ts +1 -0
- package/lib/Socket/PaxHeaders.0/swzesty st 1963.js +1 -0
- package/lib/Socket/business.d.ts +171 -0
- package/lib/Socket/business.js +260 -0
- package/lib/Socket/chats.d.ts +84 -0
- package/lib/Socket/chats.js +890 -0
- package/lib/Socket/groups.d.ts +115 -0
- package/lib/Socket/groups.js +317 -0
- package/lib/Socket/index.d.ts +173 -0
- package/lib/Socket/index.js +10 -0
- package/lib/Socket/messages-recv.d.ts +161 -0
- package/lib/Socket/messages-recv.js +1110 -0
- package/lib/Socket/messages-send.d.ts +149 -0
- package/lib/Socket/messages-send.js +805 -0
- package/lib/Socket/newsletter.d.ts +134 -0
- package/lib/Socket/newsletter.js +236 -0
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +43 -0
- package/lib/Socket/socket.js +630 -0
- package/lib/Socket/sw/303/250zesty /303/250st 1963.d.ts" +220 -0
- package/lib/Socket/sw/303/250zesty /303/250st 1963.js" +437 -0
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +427 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +110 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.d.ts +13 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +102 -0
- package/lib/Types/Chat.js +4 -0
- package/lib/Types/Contact.d.ts +19 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +157 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +55 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +35 -0
- package/lib/Types/Label.js +27 -0
- package/lib/Types/LabelAssociation.d.ts +29 -0
- package/lib/Types/LabelAssociation.js +9 -0
- package/lib/Types/Message.d.ts +273 -0
- package/lib/Types/Message.js +9 -0
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Newsletter.js +32 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.d.ts +57 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +111 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.d.ts +27 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +57 -0
- package/lib/Types/index.js +42 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/lib/Utils/auth-utils.js +206 -0
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +22 -0
- package/lib/Utils/business.js +234 -0
- package/lib/Utils/chat-utils.d.ts +71 -0
- package/lib/Utils/chat-utils.js +729 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/crypto.js +151 -0
- package/lib/Utils/decode-wa-message.d.ts +19 -0
- package/lib/Utils/decode-wa-message.js +198 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/lib/Utils/event-buffer.js +514 -0
- package/lib/Utils/generics.d.ts +92 -0
- package/lib/Utils/generics.js +391 -0
- package/lib/Utils/history.d.ts +15 -0
- package/lib/Utils/history.js +96 -0
- package/lib/Utils/index.d.ts +17 -0
- package/lib/Utils/index.js +33 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +93 -0
- package/lib/Utils/logger.d.ts +4 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +51 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +43 -0
- package/lib/Utils/messages-media.d.ts +116 -0
- package/lib/Utils/messages-media.js +731 -0
- package/lib/Utils/messages.d.ts +77 -0
- package/lib/Utils/messages.js +825 -0
- package/lib/Utils/noise-handler.d.ts +21 -0
- package/lib/Utils/noise-handler.js +155 -0
- package/lib/Utils/process-message.d.ts +41 -0
- package/lib/Utils/process-message.js +321 -0
- package/lib/Utils/signal.d.ts +32 -0
- package/lib/Utils/signal.js +151 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.js +81 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +205 -0
- package/lib/WABinary/constants.d.ts +27 -0
- package/lib/WABinary/constants.js +40 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.js +252 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +228 -0
- package/lib/WABinary/generic-utils.d.ts +16 -0
- package/lib/WABinary/generic-utils.js +199 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.d.ts +31 -0
- package/lib/WABinary/jid-utils.js +62 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +17 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +28 -0
- package/lib/WAUSync/USyncQuery.js +89 -0
- package/lib/WAUSync/USyncUser.d.ts +12 -0
- package/lib/WAUSync/USyncUser.js +26 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +85 -0
- package/lib/index.js.bak +44 -0
- package/lib/index.js.bak2 +133 -0
- package/package.json +108 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
// swèzesty èst 1963.d.ts
|
2
|
+
// Swèzesty
|
3
|
+
import { proto } from '../../WAProto';
|
4
|
+
|
5
|
+
declare namespace swezesty {
|
6
|
+
interface MediaUploadOptions {
|
7
|
+
fileEncSha256?: Buffer;
|
8
|
+
mediaType?: string;
|
9
|
+
newsletter?: boolean;
|
10
|
+
}
|
11
|
+
|
12
|
+
type WAMediaUploadFunction = (
|
13
|
+
stream: Buffer | NodeJS.ReadableStream,
|
14
|
+
options?: MediaUploadOptions
|
15
|
+
) => Promise<{ url: string; directPath: string }>;
|
16
|
+
|
17
|
+
interface WAMessageContentGenerationOptions {
|
18
|
+
upload?: WAMediaUploadFunction;
|
19
|
+
mediaCache?: any;
|
20
|
+
options?: any;
|
21
|
+
logger?: any;
|
22
|
+
}
|
23
|
+
|
24
|
+
interface StickerMessage {
|
25
|
+
url: string;
|
26
|
+
fileSha256: Buffer | string;
|
27
|
+
fileEncSha256: Buffer | string;
|
28
|
+
mediaKey: Buffer | string;
|
29
|
+
mimetype: string;
|
30
|
+
directPath: string;
|
31
|
+
fileLength: number | string;
|
32
|
+
mediaKeyTimestamp: number | string;
|
33
|
+
isAnimated?: boolean;
|
34
|
+
stickerSentTs?: number | string;
|
35
|
+
isAvatar?: boolean;
|
36
|
+
isAiSticker?: boolean;
|
37
|
+
isLottie?: boolean;
|
38
|
+
}
|
39
|
+
|
40
|
+
interface PaymentMessage {
|
41
|
+
amount: number;
|
42
|
+
currency?: string;
|
43
|
+
from?: string;
|
44
|
+
expiry?: number;
|
45
|
+
sticker?: { stickerMessage: StickerMessage };
|
46
|
+
note?: string;
|
47
|
+
background?: {
|
48
|
+
id?: string;
|
49
|
+
fileLength?: string;
|
50
|
+
width?: number;
|
51
|
+
height?: number;
|
52
|
+
mimetype?: string;
|
53
|
+
placeholderArgb?: number;
|
54
|
+
textArgb?: number;
|
55
|
+
subtextArgb?: number;
|
56
|
+
};
|
57
|
+
}
|
58
|
+
|
59
|
+
interface ProductMessage {
|
60
|
+
title: string;
|
61
|
+
description: string;
|
62
|
+
thumbnail: Buffer | { url: string };
|
63
|
+
productId: string;
|
64
|
+
retailerId: string;
|
65
|
+
url: string;
|
66
|
+
body?: string;
|
67
|
+
footer?: string;
|
68
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
69
|
+
priceAmount1000?: number | null;
|
70
|
+
currencyCode?: string;
|
71
|
+
}
|
72
|
+
|
73
|
+
interface InteractiveMessage {
|
74
|
+
title: string;
|
75
|
+
footer?: string;
|
76
|
+
thumbnail?: string;
|
77
|
+
image?: string | Buffer | { url: string };
|
78
|
+
video?: string | Buffer | { url: string };
|
79
|
+
document?: Buffer;
|
80
|
+
mimetype?: string;
|
81
|
+
fileName?: string;
|
82
|
+
jpegThumbnail?: Buffer; // Hanya Buffer saja
|
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?: { url: string; caption?: string };
|
121
|
+
video?: { 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 MessageContent {
|
152
|
+
requestPaymentMessage?: PaymentMessage;
|
153
|
+
productMessage?: ProductMessage;
|
154
|
+
interactiveMessage?: InteractiveMessage;
|
155
|
+
albumMessage?: AlbumItem[];
|
156
|
+
eventMessage?: EventMessage;
|
157
|
+
pollResultMessage?: PollResultMessage;
|
158
|
+
sender?: string;
|
159
|
+
}
|
160
|
+
|
161
|
+
interface MessageOptions {
|
162
|
+
quoted?: proto.IWebMessageInfo;
|
163
|
+
filter?: boolean;
|
164
|
+
}
|
165
|
+
|
166
|
+
interface Utils {
|
167
|
+
prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
168
|
+
generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
169
|
+
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
170
|
+
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
171
|
+
generateMessageID: () => string;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
declare class kikyy {
|
176
|
+
constructor(
|
177
|
+
utils: kikyy.Utils,
|
178
|
+
waUploadToServer: kikyy.WAMediaUploadFunction,
|
179
|
+
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
180
|
+
);
|
181
|
+
|
182
|
+
detectType(content: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | null;
|
183
|
+
|
184
|
+
handlePayment(
|
185
|
+
content: { requestPaymentMessage: kikyy.PaymentMessage },
|
186
|
+
quoted?: proto.IWebMessageInfo
|
187
|
+
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
188
|
+
|
189
|
+
handleProduct(
|
190
|
+
content: { productMessage: kikyy.ProductMessage },
|
191
|
+
jid: string,
|
192
|
+
quoted?: proto.IWebMessageInfo
|
193
|
+
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
194
|
+
|
195
|
+
handleInteractive(
|
196
|
+
content: { interactiveMessage: kikyy.InteractiveMessage },
|
197
|
+
jid: string,
|
198
|
+
quoted?: proto.IWebMessageInfo
|
199
|
+
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
200
|
+
|
201
|
+
handleAlbum(
|
202
|
+
content: { albumMessage: kikyy.AlbumItem[] },
|
203
|
+
jid: string,
|
204
|
+
quoted?: proto.IWebMessageInfo
|
205
|
+
): Promise<any>;
|
206
|
+
|
207
|
+
handleEvent(
|
208
|
+
content: { eventMessage: kikyy.EventMessage },
|
209
|
+
jid: string,
|
210
|
+
quoted?: proto.IWebMessageInfo
|
211
|
+
): Promise<any>;
|
212
|
+
|
213
|
+
handlePollResult(
|
214
|
+
content: { pollResultMessage: kikyy.PollResultMessage },
|
215
|
+
jid: string,
|
216
|
+
quoted?: proto.IWebMessageInfo
|
217
|
+
): Promise<any>;
|
218
|
+
}
|
219
|
+
|
220
|
+
export = swezesty;
|
@@ -0,0 +1,437 @@
|
|
1
|
+
const WAProto = require('../../WAProto').proto;
|
2
|
+
const crypto = require('crypto');
|
3
|
+
|
4
|
+
class swezesty {
|
5
|
+
constructor(utils, waUploadToServer, relayMessageFn) {
|
6
|
+
this.utils = utils;
|
7
|
+
this.relayMessage = relayMessageFn
|
8
|
+
this.waUploadToServer = waUploadToServer;
|
9
|
+
}
|
10
|
+
|
11
|
+
detectType(content) {
|
12
|
+
if (content.requestPaymentMessage) return 'PAYMENT';
|
13
|
+
if (content.productMessage) return 'PRODUCT';
|
14
|
+
if (content.interactiveMessage) return 'INTERACTIVE';
|
15
|
+
if (content.albumMessage) return 'ALBUM';
|
16
|
+
if (content.eventMessage) return 'EVENT';
|
17
|
+
if (content.pollResultMessage) return 'POLL_RESULT'
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
|
21
|
+
async handlePayment(content, quoted) {
|
22
|
+
const data = content.requestPaymentMessage;
|
23
|
+
let notes = {};
|
24
|
+
|
25
|
+
if (data.sticker?.stickerMessage) {
|
26
|
+
notes = {
|
27
|
+
stickerMessage: {
|
28
|
+
...data.sticker.stickerMessage,
|
29
|
+
contextInfo: {
|
30
|
+
stanzaId: quoted?.key?.id,
|
31
|
+
participant: quoted?.key?.participant || content.sender,
|
32
|
+
quotedMessage: quoted?.message
|
33
|
+
}
|
34
|
+
}
|
35
|
+
};
|
36
|
+
} else if (data.note) {
|
37
|
+
notes = {
|
38
|
+
extendedTextMessage: {
|
39
|
+
text: data.note,
|
40
|
+
contextInfo: {
|
41
|
+
stanzaId: quoted?.key?.id,
|
42
|
+
participant: quoted?.key?.participant || content.sender,
|
43
|
+
quotedMessage: quoted?.message
|
44
|
+
}
|
45
|
+
}
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
return {
|
50
|
+
requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
|
51
|
+
expiryTimestamp: data.expiry || 0,
|
52
|
+
amount1000: data.amount || 0,
|
53
|
+
currencyCodeIso4217: data.currency || "IDR",
|
54
|
+
requestFrom: data.from || "0@s.whatsapp.net",
|
55
|
+
noteMessage: notes,
|
56
|
+
background: data.background ?? {
|
57
|
+
id: "DEFAULT",
|
58
|
+
placeholderArgb: 0xFFF0F0F0
|
59
|
+
}
|
60
|
+
})
|
61
|
+
};
|
62
|
+
}
|
63
|
+
|
64
|
+
async handleProduct(content, jid, quoted) {
|
65
|
+
const {
|
66
|
+
title,
|
67
|
+
description,
|
68
|
+
thumbnail,
|
69
|
+
productId,
|
70
|
+
retailerId,
|
71
|
+
url,
|
72
|
+
body = "",
|
73
|
+
footer = "",
|
74
|
+
buttons = [],
|
75
|
+
priceAmount1000 = null,
|
76
|
+
currencyCode = "IDR"
|
77
|
+
} = content.productMessage;
|
78
|
+
|
79
|
+
let productImage;
|
80
|
+
|
81
|
+
if (Buffer.isBuffer(thumbnail)) {
|
82
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
83
|
+
{ image: thumbnail },
|
84
|
+
{ upload: this.waUploadToServer }
|
85
|
+
);
|
86
|
+
productImage = imageMessage;
|
87
|
+
} else if (typeof thumbnail === 'object' && thumbnail.url) {
|
88
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
89
|
+
{ image: { url: thumbnail.url }},
|
90
|
+
{ upload: this.waUploadToServer }
|
91
|
+
);
|
92
|
+
productImage = imageMessage;
|
93
|
+
}
|
94
|
+
|
95
|
+
return {
|
96
|
+
viewOnceMessage: {
|
97
|
+
message: {
|
98
|
+
interactiveMessage: {
|
99
|
+
body: { text: body },
|
100
|
+
footer: { text: footer },
|
101
|
+
header: {
|
102
|
+
title,
|
103
|
+
hasMediaAttachment: true,
|
104
|
+
productMessage: {
|
105
|
+
product: {
|
106
|
+
productImage,
|
107
|
+
productId,
|
108
|
+
title,
|
109
|
+
description,
|
110
|
+
currencyCode,
|
111
|
+
priceAmount1000,
|
112
|
+
retailerId,
|
113
|
+
url,
|
114
|
+
productImageCount: 1
|
115
|
+
},
|
116
|
+
businessOwnerJid: "0@s.whatsapp.net"
|
117
|
+
}
|
118
|
+
},
|
119
|
+
nativeFlowMessage: { buttons }
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
};
|
124
|
+
}
|
125
|
+
|
126
|
+
async handleInteractive(content, jid, quoted) {
|
127
|
+
const {
|
128
|
+
title,
|
129
|
+
footer,
|
130
|
+
thumbnail,
|
131
|
+
image,
|
132
|
+
video,
|
133
|
+
document,
|
134
|
+
mimetype,
|
135
|
+
fileName,
|
136
|
+
jpegThumbnail,
|
137
|
+
contextInfo,
|
138
|
+
externalAdReply,
|
139
|
+
buttons = [],
|
140
|
+
nativeFlowMessage
|
141
|
+
} = content.interactiveMessage;
|
142
|
+
|
143
|
+
let media = null;
|
144
|
+
let mediaType = null;
|
145
|
+
|
146
|
+
if (thumbnail) {
|
147
|
+
media = await this.utils.prepareWAMessageMedia(
|
148
|
+
{ image: { url: thumbnail } },
|
149
|
+
{ upload: this.waUploadToServer }
|
150
|
+
);
|
151
|
+
mediaType = 'image';
|
152
|
+
} else if (image) {
|
153
|
+
if (typeof image === 'object' && image.url) {
|
154
|
+
media = await this.utils.prepareWAMessageMedia(
|
155
|
+
{ image: { url: image.url } },
|
156
|
+
{ upload: this.waUploadToServer }
|
157
|
+
);
|
158
|
+
} else {
|
159
|
+
media = await this.utils.prepareWAMessageMedia(
|
160
|
+
{ image: image },
|
161
|
+
{ upload: this.waUploadToServer }
|
162
|
+
);
|
163
|
+
}
|
164
|
+
mediaType = 'image';
|
165
|
+
} else if (video) {
|
166
|
+
if (typeof video === 'object' && video.url) {
|
167
|
+
media = await this.utils.prepareWAMessageMedia(
|
168
|
+
{ video: { url: video.url } },
|
169
|
+
{ upload: this.waUploadToServer }
|
170
|
+
);
|
171
|
+
} else {
|
172
|
+
media = await this.utils.prepareWAMessageMedia(
|
173
|
+
{ video: video },
|
174
|
+
{ upload: this.waUploadToServer }
|
175
|
+
);
|
176
|
+
}
|
177
|
+
mediaType = 'video';
|
178
|
+
} else if (document) {
|
179
|
+
let documentPayload = { document: document };
|
180
|
+
|
181
|
+
if (jpegThumbnail) {
|
182
|
+
if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
|
183
|
+
documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
|
184
|
+
} else {
|
185
|
+
documentPayload.jpegThumbnail = jpegThumbnail;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
media = await this.utils.prepareWAMessageMedia(
|
190
|
+
documentPayload,
|
191
|
+
{ upload: this.waUploadToServer }
|
192
|
+
);
|
193
|
+
|
194
|
+
if (fileName) {
|
195
|
+
media.documentMessage.fileName = fileName;
|
196
|
+
}
|
197
|
+
if (mimetype) {
|
198
|
+
media.documentMessage.mimetype = mimetype;
|
199
|
+
}
|
200
|
+
mediaType = 'document';
|
201
|
+
}
|
202
|
+
|
203
|
+
let interactiveMessage = {
|
204
|
+
body: { text: title || "" },
|
205
|
+
footer: { text: footer || "" }
|
206
|
+
};
|
207
|
+
|
208
|
+
if (buttons && buttons.length > 0) {
|
209
|
+
interactiveMessage.nativeFlowMessage = {
|
210
|
+
buttons: buttons
|
211
|
+
};
|
212
|
+
|
213
|
+
if (nativeFlowMessage) {
|
214
|
+
interactiveMessage.nativeFlowMessage = {
|
215
|
+
...interactiveMessage.nativeFlowMessage,
|
216
|
+
...nativeFlowMessage
|
217
|
+
};
|
218
|
+
}
|
219
|
+
} else if (nativeFlowMessage) {
|
220
|
+
interactiveMessage.nativeFlowMessage = nativeFlowMessage;
|
221
|
+
}
|
222
|
+
|
223
|
+
if (media) {
|
224
|
+
interactiveMessage.header = {
|
225
|
+
title: "",
|
226
|
+
hasMediaAttachment: true,
|
227
|
+
...media
|
228
|
+
};
|
229
|
+
} else {
|
230
|
+
interactiveMessage.header = {
|
231
|
+
title: "",
|
232
|
+
hasMediaAttachment: false
|
233
|
+
};
|
234
|
+
}
|
235
|
+
|
236
|
+
let finalContextInfo = {};
|
237
|
+
|
238
|
+
if (contextInfo) {
|
239
|
+
finalContextInfo = {
|
240
|
+
mentionedJid: contextInfo.mentionedJid || [],
|
241
|
+
forwardingScore: contextInfo.forwardingScore || 0,
|
242
|
+
isForwarded: contextInfo.isForwarded || false,
|
243
|
+
...contextInfo
|
244
|
+
};
|
245
|
+
}
|
246
|
+
|
247
|
+
if (externalAdReply) {
|
248
|
+
finalContextInfo.externalAdReply = {
|
249
|
+
title: externalAdReply.title || "",
|
250
|
+
body: externalAdReply.body || "",
|
251
|
+
mediaType: externalAdReply.mediaType || 1,
|
252
|
+
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
253
|
+
mediaUrl: externalAdReply.mediaUrl || "",
|
254
|
+
sourceUrl: externalAdReply.sourceUrl || "",
|
255
|
+
showAdAttribution: externalAdReply.showAdAttribution || false,
|
256
|
+
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
257
|
+
...externalAdReply
|
258
|
+
};
|
259
|
+
}
|
260
|
+
|
261
|
+
if (Object.keys(finalContextInfo).length > 0) {
|
262
|
+
interactiveMessage.contextInfo = finalContextInfo;
|
263
|
+
}
|
264
|
+
|
265
|
+
return {
|
266
|
+
interactiveMessage: interactiveMessage
|
267
|
+
};
|
268
|
+
}
|
269
|
+
|
270
|
+
async handleAlbum(content, jid, quoted) {
|
271
|
+
const array = content.albumMessage;
|
272
|
+
const album = await this.utils.generateWAMessageFromContent(jid, {
|
273
|
+
messageContextInfo: {
|
274
|
+
messageSecret: crypto.randomBytes(32),
|
275
|
+
},
|
276
|
+
albumMessage: {
|
277
|
+
expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
|
278
|
+
expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
|
279
|
+
},
|
280
|
+
}, {
|
281
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
282
|
+
quoted,
|
283
|
+
upload: this.waUploadToServer
|
284
|
+
});
|
285
|
+
|
286
|
+
await this.relayMessage(jid, album.message, {
|
287
|
+
messageId: album.key.id,
|
288
|
+
});
|
289
|
+
|
290
|
+
for (let content of array) {
|
291
|
+
const img = await this.utils.generateWAMessage(jid, content, {
|
292
|
+
upload: this.waUploadToServer,
|
293
|
+
});
|
294
|
+
|
295
|
+
img.message.messageContextInfo = {
|
296
|
+
messageSecret: crypto.randomBytes(32),
|
297
|
+
messageAssociation: {
|
298
|
+
associationType: 1,
|
299
|
+
parentMessageKey: album.key,
|
300
|
+
},
|
301
|
+
participant: "0@s.whatsapp.net",
|
302
|
+
remoteJid: "status@broadcast",
|
303
|
+
forwardingScore: 99999,
|
304
|
+
isForwarded: true,
|
305
|
+
mentionedJid: [jid],
|
306
|
+
starred: true,
|
307
|
+
labels: ["Y", "Important"],
|
308
|
+
isHighlighted: true,
|
309
|
+
businessMessageForwardInfo: {
|
310
|
+
businessOwnerJid: jid,
|
311
|
+
},
|
312
|
+
dataSharingContext: {
|
313
|
+
showMmDisclosure: true,
|
314
|
+
},
|
315
|
+
};
|
316
|
+
|
317
|
+
img.message.forwardedNewsletterMessageInfo = {
|
318
|
+
newsletterJid: "0@newsletter",
|
319
|
+
serverMessageId: 1,
|
320
|
+
newsletterName: `WhatsApp`,
|
321
|
+
contentType: 1,
|
322
|
+
timestamp: new Date().toISOString(),
|
323
|
+
senderName: "swèzesty èst 1963",
|
324
|
+
content: "Text Message",
|
325
|
+
priority: "high",
|
326
|
+
status: "sent",
|
327
|
+
};
|
328
|
+
|
329
|
+
img.message.disappearingMode = {
|
330
|
+
initiator: 3,
|
331
|
+
trigger: 4,
|
332
|
+
initiatorDeviceJid: jid,
|
333
|
+
initiatedByExternalService: true,
|
334
|
+
initiatedByUserDevice: true,
|
335
|
+
initiatedBySystem: true,
|
336
|
+
initiatedByServer: true,
|
337
|
+
initiatedByAdmin: true,
|
338
|
+
initiatedByUser: true,
|
339
|
+
initiatedByApp: true,
|
340
|
+
initiatedByBot: true,
|
341
|
+
initiatedByMe: true,
|
342
|
+
};
|
343
|
+
|
344
|
+
await this.relayMessage(jid, img.message, {
|
345
|
+
messageId: img.key.id,
|
346
|
+
quoted: {
|
347
|
+
key: {
|
348
|
+
remoteJid: album.key.remoteJid,
|
349
|
+
id: album.key.id,
|
350
|
+
fromMe: true,
|
351
|
+
participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
352
|
+
},
|
353
|
+
message: album.message,
|
354
|
+
},
|
355
|
+
});
|
356
|
+
}
|
357
|
+
return album;
|
358
|
+
}
|
359
|
+
|
360
|
+
async handleEvent(content, jid, quoted) {
|
361
|
+
const eventData = content.eventMessage;
|
362
|
+
|
363
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
364
|
+
viewOnceMessage: {
|
365
|
+
message: {
|
366
|
+
messageContextInfo: {
|
367
|
+
deviceListMetadata: {},
|
368
|
+
deviceListMetadataVersion: 2,
|
369
|
+
messageSecret: crypto.randomBytes(32),
|
370
|
+
supportPayload: JSON.stringify({
|
371
|
+
version: 2,
|
372
|
+
is_ai_message: true,
|
373
|
+
should_show_system_message: true,
|
374
|
+
ticket_id: crypto.randomBytes(16).toString('hex')
|
375
|
+
})
|
376
|
+
},
|
377
|
+
eventMessage: {
|
378
|
+
contextInfo: {
|
379
|
+
mentionedJid: [jid],
|
380
|
+
participant: jid,
|
381
|
+
remoteJid: "status@broadcast",
|
382
|
+
forwardedNewsletterMessageInfo: {
|
383
|
+
newsletterName: "shenvn.",
|
384
|
+
newsletterJid: "120363297591152843@newsletter",
|
385
|
+
serverMessageId: 1
|
386
|
+
}
|
387
|
+
},
|
388
|
+
isCanceled: eventData.isCanceled || false,
|
389
|
+
name: eventData.name,
|
390
|
+
description: eventData.description,
|
391
|
+
location: eventData.location || {
|
392
|
+
degreesLatitude: 0,
|
393
|
+
degreesLongitude: 0,
|
394
|
+
name: "Location"
|
395
|
+
},
|
396
|
+
joinLink: eventData.joinLink || '',
|
397
|
+
startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
|
398
|
+
endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
|
399
|
+
extraGuestsAllowed: eventData.extraGuestsAllowed !== false
|
400
|
+
}
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}, { quoted });
|
404
|
+
|
405
|
+
await this.relayMessage(jid, msg.message, {
|
406
|
+
messageId: msg.key.id
|
407
|
+
});
|
408
|
+
return msg;
|
409
|
+
}
|
410
|
+
|
411
|
+
async handlePollResult(content, jid, quoted) {
|
412
|
+
const pollData = content.pollResultMessage;
|
413
|
+
|
414
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
415
|
+
pollResultSnapshotMessage: {
|
416
|
+
name: pollData.name,
|
417
|
+
pollVotes: pollData.pollVotes.map(vote => ({
|
418
|
+
optionName: vote.optionName,
|
419
|
+
optionVoteCount: typeof vote.optionVoteCount === 'number'
|
420
|
+
? vote.optionVoteCount.toString()
|
421
|
+
: vote.optionVoteCount
|
422
|
+
}))
|
423
|
+
}
|
424
|
+
}, {
|
425
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
426
|
+
quoted
|
427
|
+
});
|
428
|
+
|
429
|
+
await this.relayMessage(jid, msg.message, {
|
430
|
+
messageId: msg.key.id
|
431
|
+
});
|
432
|
+
|
433
|
+
return msg;
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
module.exports = swezesty;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
2
|
+
import { SocketConfig } from '../Types';
|
3
|
+
import { BinaryNode } from '../WABinary';
|
4
|
+
import { USyncQuery } from '../WAUSync';
|
5
|
+
export declare const makeUSyncSocket: (config: SocketConfig) => {
|
6
|
+
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
|
7
|
+
type: "md";
|
8
|
+
ws: import("./Client").WebSocketClient;
|
9
|
+
ev: import("../Types").BaileysEventEmitter & {
|
10
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
11
|
+
buffer(): void;
|
12
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
13
|
+
flush(force?: boolean): boolean;
|
14
|
+
isBuffering(): boolean;
|
15
|
+
};
|
16
|
+
authState: {
|
17
|
+
creds: import("../Types").AuthenticationCreds;
|
18
|
+
keys: import("../Types").SignalKeyStoreWithTransaction;
|
19
|
+
};
|
20
|
+
signalRepository: import("../Types").SignalRepository;
|
21
|
+
user: import("../Types").Contact | undefined;
|
22
|
+
generateMessageTag: () => string;
|
23
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
24
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
25
|
+
waitForSocketOpen: () => Promise<void>;
|
26
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
27
|
+
sendNode: (frame: BinaryNode) => Promise<void>;
|
28
|
+
logout: (msg?: string) => Promise<void>;
|
29
|
+
end: (error: Error | undefined) => void;
|
30
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
31
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
32
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
33
|
+
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
34
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
35
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
36
|
+
};
|