@alannxd/baileys 2.1.3 → 3.0.0
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 +86 -12
- package/WAProto/index.js +56886 -17506
- package/lib/Defaults/index.js +19 -2
- package/lib/Socket/chats.d.ts +215 -28
- package/lib/Socket/chats.js +155 -49
- package/lib/Socket/dugong.d.ts +92 -13
- package/lib/Socket/dugong.js +206 -64
- package/lib/Socket/groups.js +1 -0
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/messages-send.js +16 -8
- package/lib/Socket/newsletter.js +114 -21
- package/lib/Socket/socket.js +66 -31
- package/lib/Types/Newsletter.d.ts +97 -86
- package/lib/Types/Newsletter.js +38 -32
- package/lib/Utils/generics.js +62 -34
- package/lib/Utils/messages-media.js +145 -57
- package/lib/Utils/messages.js +26 -14
- package/lib/Utils/use-multi-file-auth-state.js +45 -6
- package/lib/Utils/validate-connection.js +89 -65
- package/lib/index.js +6 -3
- package/package.json +5 -3
package/lib/Socket/dugong.d.ts
CHANGED
|
@@ -58,26 +58,67 @@ declare namespace kikyy {
|
|
|
58
58
|
interface ProductMessage {
|
|
59
59
|
title: string;
|
|
60
60
|
description: string;
|
|
61
|
-
thumbnail: string;
|
|
61
|
+
thumbnail: Buffer | { url: string };
|
|
62
62
|
productId: string;
|
|
63
63
|
retailerId: string;
|
|
64
64
|
url: string;
|
|
65
65
|
body?: string;
|
|
66
66
|
footer?: string;
|
|
67
67
|
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
68
|
+
priceAmount1000?: number | null;
|
|
69
|
+
currencyCode?: string;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
interface InteractiveMessage {
|
|
73
|
+
header?: string;
|
|
71
74
|
title: string;
|
|
72
75
|
footer?: string;
|
|
73
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
|
+
};
|
|
74
111
|
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
75
|
-
nativeFlowMessage?:
|
|
112
|
+
nativeFlowMessage?: {
|
|
113
|
+
messageParamsJson?: string;
|
|
114
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
};
|
|
76
117
|
}
|
|
77
118
|
|
|
78
119
|
interface AlbumItem {
|
|
79
|
-
image?: { url: string; caption?: string };
|
|
80
|
-
video?: { url: string; caption?: string };
|
|
120
|
+
image?: string | Buffer | { url: string; caption?: string };
|
|
121
|
+
video?: string | Buffer | { url: string; caption?: string };
|
|
81
122
|
}
|
|
82
123
|
|
|
83
124
|
interface EventMessageLocation {
|
|
@@ -106,6 +147,16 @@ declare namespace kikyy {
|
|
|
106
147
|
name: string;
|
|
107
148
|
pollVotes: PollVote[];
|
|
108
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
|
+
}
|
|
109
160
|
|
|
110
161
|
interface MessageContent {
|
|
111
162
|
requestPaymentMessage?: PaymentMessage;
|
|
@@ -114,27 +165,39 @@ declare namespace kikyy {
|
|
|
114
165
|
albumMessage?: AlbumItem[];
|
|
115
166
|
eventMessage?: EventMessage;
|
|
116
167
|
pollResultMessage?: PollResultMessage;
|
|
168
|
+
groupStatusMessage?: GroupStatusMessage;
|
|
169
|
+
sender?: string;
|
|
117
170
|
}
|
|
118
171
|
|
|
119
172
|
interface MessageOptions {
|
|
120
173
|
quoted?: proto.IWebMessageInfo;
|
|
121
174
|
filter?: boolean;
|
|
122
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
|
+
}
|
|
123
191
|
}
|
|
124
192
|
|
|
125
193
|
declare class kikyy {
|
|
126
194
|
constructor(
|
|
127
|
-
utils:
|
|
128
|
-
prepareWAMessageMedia: (media: any, options: kikyy.WAMessageContentGenerationOptions) => Promise<any>;
|
|
129
|
-
generateWAMessageContent: (content: any, options: kikyy.WAMessageContentGenerationOptions) => Promise<any>;
|
|
130
|
-
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
131
|
-
generateMessageID: () => string;
|
|
132
|
-
},
|
|
195
|
+
utils: kikyy.Utils,
|
|
133
196
|
waUploadToServer: kikyy.WAMediaUploadFunction,
|
|
134
197
|
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
135
198
|
);
|
|
136
199
|
|
|
137
|
-
detectType(content: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | null;
|
|
200
|
+
detectType(content: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
|
|
138
201
|
|
|
139
202
|
handlePayment(
|
|
140
203
|
content: { requestPaymentMessage: kikyy.PaymentMessage },
|
|
@@ -151,7 +214,7 @@ declare class kikyy {
|
|
|
151
214
|
content: { interactiveMessage: kikyy.InteractiveMessage },
|
|
152
215
|
jid: string,
|
|
153
216
|
quoted?: proto.IWebMessageInfo
|
|
154
|
-
): Promise<{
|
|
217
|
+
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
155
218
|
|
|
156
219
|
handleAlbum(
|
|
157
220
|
content: { albumMessage: kikyy.AlbumItem[] },
|
|
@@ -170,6 +233,22 @@ declare class kikyy {
|
|
|
170
233
|
jid: string,
|
|
171
234
|
quoted?: proto.IWebMessageInfo
|
|
172
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;
|
|
173
252
|
}
|
|
174
253
|
|
|
175
|
-
export = kikyy;
|
|
254
|
+
export = kikyy;
|
package/lib/Socket/dugong.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
// "kikyy dugonggg",
|
|
1
|
+
// "kikyy dugonggg", ah dejavu (r)
|
|
2
2
|
// tanggal 14 agustus 2025 makassar
|
|
3
|
-
// telegram: @
|
|
3
|
+
// telegram: @tskiofc & @kyuucode
|
|
4
4
|
|
|
5
5
|
const WAProto = require('../../WAProto').proto;
|
|
6
6
|
const crypto = require('crypto');
|
|
7
|
+
const Utils_1 = require("../Utils");
|
|
7
8
|
|
|
8
9
|
class kikyy {
|
|
9
10
|
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
10
11
|
this.utils = utils;
|
|
11
12
|
this.relayMessage = relayMessageFn
|
|
12
13
|
this.waUploadToServer = waUploadToServer;
|
|
14
|
+
|
|
15
|
+
this.bail = {
|
|
16
|
+
generateWAMessageContent: this.utils.generateWAMessageContent || Utils_1.generateWAMessageContent,
|
|
17
|
+
generateMessageID: Utils_1.generateMessageID,
|
|
18
|
+
getContentType: (msg) => Object.keys(msg.message || {})[0]
|
|
19
|
+
};
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
detectType(content) {
|
|
@@ -18,7 +25,8 @@ class kikyy {
|
|
|
18
25
|
if (content.interactiveMessage) return 'INTERACTIVE';
|
|
19
26
|
if (content.albumMessage) return 'ALBUM';
|
|
20
27
|
if (content.eventMessage) return 'EVENT';
|
|
21
|
-
if (content.pollResultMessage) return 'POLL_RESULT'
|
|
28
|
+
if (content.pollResultMessage) return 'POLL_RESULT';
|
|
29
|
+
if (content.groupStatusMessage) return 'GROUP_STORY';
|
|
22
30
|
return null;
|
|
23
31
|
}
|
|
24
32
|
|
|
@@ -64,7 +72,7 @@ class kikyy {
|
|
|
64
72
|
})
|
|
65
73
|
};
|
|
66
74
|
}
|
|
67
|
-
|
|
75
|
+
|
|
68
76
|
async handleProduct(content, jid, quoted) {
|
|
69
77
|
const {
|
|
70
78
|
title,
|
|
@@ -75,13 +83,26 @@ class kikyy {
|
|
|
75
83
|
url,
|
|
76
84
|
body = "",
|
|
77
85
|
footer = "",
|
|
78
|
-
buttons = []
|
|
86
|
+
buttons = [],
|
|
87
|
+
priceAmount1000 = null,
|
|
88
|
+
currencyCode = "IDR"
|
|
79
89
|
} = content.productMessage;
|
|
80
90
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
let productImage;
|
|
92
|
+
|
|
93
|
+
if (Buffer.isBuffer(thumbnail)) {
|
|
94
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
95
|
+
{ image: thumbnail },
|
|
96
|
+
{ upload: this.waUploadToServer }
|
|
97
|
+
);
|
|
98
|
+
productImage = imageMessage;
|
|
99
|
+
} else if (typeof thumbnail === 'object' && thumbnail.url) {
|
|
100
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
101
|
+
{ image: { url: thumbnail.url }},
|
|
102
|
+
{ upload: this.waUploadToServer }
|
|
103
|
+
);
|
|
104
|
+
productImage = imageMessage;
|
|
105
|
+
}
|
|
85
106
|
|
|
86
107
|
return {
|
|
87
108
|
viewOnceMessage: {
|
|
@@ -94,12 +115,12 @@ class kikyy {
|
|
|
94
115
|
hasMediaAttachment: true,
|
|
95
116
|
productMessage: {
|
|
96
117
|
product: {
|
|
97
|
-
productImage
|
|
118
|
+
productImage,
|
|
98
119
|
productId,
|
|
99
120
|
title,
|
|
100
121
|
description,
|
|
101
|
-
currencyCode
|
|
102
|
-
priceAmount1000
|
|
122
|
+
currencyCode,
|
|
123
|
+
priceAmount1000,
|
|
103
124
|
retailerId,
|
|
104
125
|
url,
|
|
105
126
|
productImageCount: 1
|
|
@@ -113,65 +134,147 @@ class kikyy {
|
|
|
113
134
|
}
|
|
114
135
|
};
|
|
115
136
|
}
|
|
116
|
-
|
|
137
|
+
|
|
117
138
|
async handleInteractive(content, jid, quoted) {
|
|
118
139
|
const {
|
|
119
140
|
title,
|
|
120
141
|
footer,
|
|
121
142
|
thumbnail,
|
|
143
|
+
image,
|
|
144
|
+
video,
|
|
145
|
+
document,
|
|
146
|
+
mimetype,
|
|
147
|
+
fileName,
|
|
148
|
+
jpegThumbnail,
|
|
149
|
+
contextInfo,
|
|
150
|
+
externalAdReply,
|
|
122
151
|
buttons = [],
|
|
123
|
-
nativeFlowMessage
|
|
152
|
+
nativeFlowMessage,
|
|
153
|
+
header
|
|
124
154
|
} = content.interactiveMessage;
|
|
125
155
|
|
|
156
|
+
let media = null;
|
|
157
|
+
let mediaType = null;
|
|
158
|
+
|
|
126
159
|
if (thumbnail) {
|
|
127
|
-
|
|
160
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
128
161
|
{ image: { url: thumbnail } },
|
|
129
162
|
{ upload: this.waUploadToServer }
|
|
130
163
|
);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
164
|
+
mediaType = 'image';
|
|
165
|
+
} else if (image) {
|
|
166
|
+
if (typeof image === 'object' && image.url) {
|
|
167
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
168
|
+
{ image: { url: image.url } },
|
|
169
|
+
{ upload: this.waUploadToServer }
|
|
170
|
+
);
|
|
171
|
+
} else {
|
|
172
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
173
|
+
{ image: image },
|
|
174
|
+
{ upload: this.waUploadToServer }
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
mediaType = 'image';
|
|
178
|
+
} else if (video) {
|
|
179
|
+
if (typeof video === 'object' && video.url) {
|
|
180
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
181
|
+
{ video: { url: video.url } },
|
|
182
|
+
{ upload: this.waUploadToServer }
|
|
183
|
+
);
|
|
184
|
+
} else {
|
|
185
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
186
|
+
{ video: video },
|
|
187
|
+
{ upload: this.waUploadToServer }
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
mediaType = 'video';
|
|
191
|
+
} else if (document) {
|
|
192
|
+
let documentPayload = {
|
|
193
|
+
document: document
|
|
194
|
+
};
|
|
195
|
+
if (jpegThumbnail) {
|
|
196
|
+
if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
|
|
197
|
+
documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
|
|
198
|
+
} else {
|
|
199
|
+
documentPayload.jpegThumbnail = jpegThumbnail;
|
|
150
200
|
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
204
|
+
documentPayload,
|
|
205
|
+
{ upload: this.waUploadToServer }
|
|
206
|
+
);
|
|
207
|
+
if (fileName) {
|
|
208
|
+
media.documentMessage.fileName = fileName;
|
|
209
|
+
}
|
|
210
|
+
if (mimetype) {
|
|
211
|
+
media.documentMessage.mimetype = mimetype;
|
|
212
|
+
}
|
|
213
|
+
mediaType = 'document';
|
|
214
|
+
}
|
|
215
|
+
let interactiveMessage = {
|
|
216
|
+
body: { text: title || "" },
|
|
217
|
+
footer: { text: footer || "" }
|
|
218
|
+
};
|
|
219
|
+
if (buttons && buttons.length > 0) {
|
|
220
|
+
interactiveMessage.nativeFlowMessage = {
|
|
221
|
+
buttons: buttons
|
|
151
222
|
};
|
|
223
|
+
if (nativeFlowMessage) {
|
|
224
|
+
interactiveMessage.nativeFlowMessage = {
|
|
225
|
+
...interactiveMessage.nativeFlowMessage,
|
|
226
|
+
...nativeFlowMessage
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
} else if (nativeFlowMessage) {
|
|
230
|
+
interactiveMessage.nativeFlowMessage = nativeFlowMessage;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (media) {
|
|
234
|
+
interactiveMessage.header = {
|
|
235
|
+
title: header || "",
|
|
236
|
+
hasMediaAttachment: true,
|
|
237
|
+
...media
|
|
238
|
+
};
|
|
239
|
+
} else {
|
|
240
|
+
interactiveMessage.header = {
|
|
241
|
+
title: header || "",
|
|
242
|
+
hasMediaAttachment: false
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
let finalContextInfo = {};
|
|
247
|
+
if (contextInfo) {
|
|
248
|
+
finalContextInfo = {
|
|
249
|
+
mentionedJid: contextInfo.mentionedJid || [],
|
|
250
|
+
forwardingScore: contextInfo.forwardingScore || 0,
|
|
251
|
+
isForwarded: contextInfo.isForwarded || false,
|
|
252
|
+
...contextInfo
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (externalAdReply) {
|
|
257
|
+
finalContextInfo.externalAdReply = {
|
|
258
|
+
title: externalAdReply.title || "",
|
|
259
|
+
body: externalAdReply.body || "",
|
|
260
|
+
mediaType: externalAdReply.mediaType || 1,
|
|
261
|
+
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
|
262
|
+
mediaUrl: externalAdReply.mediaUrl || "",
|
|
263
|
+
sourceUrl: externalAdReply.sourceUrl || "",
|
|
264
|
+
showAdAttribution: externalAdReply.showAdAttribution || false,
|
|
265
|
+
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
|
266
|
+
...externalAdReply
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (Object.keys(finalContextInfo).length > 0) {
|
|
271
|
+
interactiveMessage.contextInfo = finalContextInfo;
|
|
152
272
|
}
|
|
153
|
-
|
|
154
273
|
return {
|
|
155
|
-
|
|
156
|
-
message: {
|
|
157
|
-
messageContextInfo: {
|
|
158
|
-
deviceListMetadata: {},
|
|
159
|
-
deviceListMetadataVersion: 2
|
|
160
|
-
},
|
|
161
|
-
interactiveMessage: WAProto.Message.InteractiveMessage.create({
|
|
162
|
-
body: { text: title },
|
|
163
|
-
footer: { text: footer },
|
|
164
|
-
header: {
|
|
165
|
-
title: "",
|
|
166
|
-
hasMediaAttachment: false
|
|
167
|
-
},
|
|
168
|
-
nativeFlowMessage: nativeFlowMessage || { buttons }
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
}
|
|
274
|
+
interactiveMessage: interactiveMessage
|
|
172
275
|
};
|
|
173
276
|
}
|
|
174
|
-
|
|
277
|
+
|
|
175
278
|
async handleAlbum(content, jid, quoted) {
|
|
176
279
|
const array = content.albumMessage;
|
|
177
280
|
const album = await this.utils.generateWAMessageFromContent(jid, {
|
|
@@ -187,16 +290,16 @@ class kikyy {
|
|
|
187
290
|
quoted,
|
|
188
291
|
upload: this.waUploadToServer
|
|
189
292
|
});
|
|
190
|
-
|
|
293
|
+
|
|
191
294
|
await this.relayMessage(jid, album.message, {
|
|
192
295
|
messageId: album.key.id,
|
|
193
296
|
});
|
|
194
|
-
|
|
297
|
+
|
|
195
298
|
for (let content of array) {
|
|
196
299
|
const img = await this.utils.generateWAMessage(jid, content, {
|
|
197
300
|
upload: this.waUploadToServer,
|
|
198
301
|
});
|
|
199
|
-
|
|
302
|
+
|
|
200
303
|
img.message.messageContextInfo = {
|
|
201
304
|
messageSecret: crypto.randomBytes(32),
|
|
202
305
|
messageAssociation: {
|
|
@@ -230,14 +333,14 @@ class kikyy {
|
|
|
230
333
|
priority: "high",
|
|
231
334
|
status: "sent",
|
|
232
335
|
};
|
|
233
|
-
|
|
336
|
+
|
|
234
337
|
img.message.disappearingMode = {
|
|
235
338
|
initiator: 3,
|
|
236
339
|
trigger: 4,
|
|
237
340
|
initiatorDeviceJid: jid,
|
|
238
341
|
initiatedByExternalService: true,
|
|
239
342
|
initiatedByUserDevice: true,
|
|
240
|
-
initiatedBySystem: true,
|
|
343
|
+
initiatedBySystem: true,
|
|
241
344
|
initiatedByServer: true,
|
|
242
345
|
initiatedByAdmin: true,
|
|
243
346
|
initiatedByUser: true,
|
|
@@ -261,7 +364,7 @@ class kikyy {
|
|
|
261
364
|
}
|
|
262
365
|
return album;
|
|
263
366
|
}
|
|
264
|
-
|
|
367
|
+
|
|
265
368
|
async handleEvent(content, jid, quoted) {
|
|
266
369
|
const eventData = content.eventMessage;
|
|
267
370
|
|
|
@@ -312,10 +415,10 @@ class kikyy {
|
|
|
312
415
|
});
|
|
313
416
|
return msg;
|
|
314
417
|
}
|
|
315
|
-
|
|
418
|
+
|
|
316
419
|
async handlePollResult(content, jid, quoted) {
|
|
317
420
|
const pollData = content.pollResultMessage;
|
|
318
|
-
|
|
421
|
+
|
|
319
422
|
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
320
423
|
pollResultSnapshotMessage: {
|
|
321
424
|
name: pollData.name,
|
|
@@ -330,13 +433,52 @@ class kikyy {
|
|
|
330
433
|
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
331
434
|
quoted
|
|
332
435
|
});
|
|
333
|
-
|
|
436
|
+
|
|
334
437
|
await this.relayMessage(jid, msg.message, {
|
|
335
438
|
messageId: msg.key.id
|
|
336
439
|
});
|
|
337
|
-
|
|
440
|
+
|
|
338
441
|
return msg;
|
|
339
442
|
}
|
|
443
|
+
|
|
444
|
+
async handleGroupStory(content, jid, quoted) {
|
|
445
|
+
const storyData = content.groupStatusMessage;
|
|
446
|
+
let waMsgContent;
|
|
447
|
+
|
|
448
|
+
if (storyData.message) {
|
|
449
|
+
waMsgContent = storyData;
|
|
450
|
+
} else {
|
|
451
|
+
if (typeof this.bail?.generateWAMessageContent === "function") {
|
|
452
|
+
waMsgContent = await this.bail.generateWAMessageContent(storyData, {
|
|
453
|
+
upload: this.waUploadToServer
|
|
454
|
+
});
|
|
455
|
+
} else if (typeof this.utils?.generateWAMessageContent === "function") {
|
|
456
|
+
waMsgContent = await this.utils.generateWAMessageContent(storyData, {
|
|
457
|
+
upload: this.waUploadToServer
|
|
458
|
+
});
|
|
459
|
+
} else if (typeof this.utils?.prepareMessageContent === "function") {
|
|
460
|
+
waMsgContent = await this.utils.prepareMessageContent(storyData, {
|
|
461
|
+
upload: this.waUploadToServer
|
|
462
|
+
});
|
|
463
|
+
} else {
|
|
464
|
+
waMsgContent = await Utils_1.generateWAMessageContent(storyData, {
|
|
465
|
+
upload: this.waUploadToServer
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
let msg = {
|
|
471
|
+
message: {
|
|
472
|
+
groupStatusMessageV2: {
|
|
473
|
+
message: waMsgContent.message || waMsgContent
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
return await this.relayMessage(jid, msg.message, {
|
|
479
|
+
messageId: this.bail.generateMessageID()
|
|
480
|
+
});
|
|
481
|
+
}
|
|
340
482
|
}
|
|
341
483
|
|
|
342
|
-
module.exports = kikyy;
|
|
484
|
+
module.exports = kikyy;
|
package/lib/Socket/groups.js
CHANGED
|
@@ -305,6 +305,7 @@ const extractGroupMetadata = (result) => {
|
|
|
305
305
|
participants: WABinary_1.getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
306
306
|
return {
|
|
307
307
|
id: attrs.jid,
|
|
308
|
+
jid: attrs.phone_number || attrs.jid,
|
|
308
309
|
admin: (attrs.type || null),
|
|
309
310
|
};
|
|
310
311
|
}),
|
package/lib/Socket/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
@@ -291,7 +291,7 @@ const makeMessagesSocket = (config) => {
|
|
|
291
291
|
}));
|
|
292
292
|
return { nodes, shouldIncludeDeviceIdentity };
|
|
293
293
|
}; //apela
|
|
294
|
-
const relayMessage = async (jid, message, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, useCachedGroupMetadata, statusJidList, AI = true }
|
|
294
|
+
const relayMessage = async (jid, message, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, useCachedGroupMetadata, statusJidList, AI = true }) => {
|
|
295
295
|
const meId = authState.creds.me.id;
|
|
296
296
|
let shouldIncludeDeviceIdentity = false;
|
|
297
297
|
let didPushAdditional = false
|
|
@@ -335,6 +335,10 @@ const makeMessagesSocket = (config) => {
|
|
|
335
335
|
extraAttrs['mediatype'] = mediaType
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
+
if (messages.pinInChatMessage || messages.keepInChatMessage || message.reactionMessage || message.protocolMessage?.editedMessage) {
|
|
339
|
+
extraAttrs['decrypt-fail'] = 'hide'
|
|
340
|
+
}
|
|
341
|
+
|
|
338
342
|
if (messages.interactiveResponseMessage?.nativeFlowResponseMessage) {
|
|
339
343
|
extraAttrs['native_flow_name'] = messages.interactiveResponseMessage?.nativeFlowResponseMessage.name
|
|
340
344
|
}
|
|
@@ -560,7 +564,7 @@ const makeMessagesSocket = (config) => {
|
|
|
560
564
|
}
|
|
561
565
|
}
|
|
562
566
|
|
|
563
|
-
if(!isNewsletter && buttonType) {
|
|
567
|
+
if(!isNewsletter && buttonType && !isStatus) {
|
|
564
568
|
const content = WABinary_1.getAdditionalNode(buttonType)
|
|
565
569
|
const filteredNode = WABinary_1.getBinaryNodeFilter(additionalNodes)
|
|
566
570
|
|
|
@@ -774,7 +778,12 @@ const makeMessagesSocket = (config) => {
|
|
|
774
778
|
throw error;
|
|
775
779
|
}
|
|
776
780
|
ev.emit('messages.update', [
|
|
777
|
-
{
|
|
781
|
+
{
|
|
782
|
+
key: message.key,
|
|
783
|
+
update: {
|
|
784
|
+
message: message.message
|
|
785
|
+
}
|
|
786
|
+
}
|
|
778
787
|
]);
|
|
779
788
|
return message;
|
|
780
789
|
},
|
|
@@ -824,14 +833,13 @@ const makeMessagesSocket = (config) => {
|
|
|
824
833
|
...getParticipantAttr()
|
|
825
834
|
});
|
|
826
835
|
case 'ALBUM':
|
|
827
|
-
|
|
828
|
-
return albumContent;
|
|
829
|
-
|
|
836
|
+
return await rahmi.handleAlbum(content, jid, quoted)
|
|
830
837
|
case 'EVENT':
|
|
831
838
|
return await rahmi.handleEvent(content, jid, quoted)
|
|
832
|
-
|
|
833
839
|
case 'POLL_RESULT':
|
|
834
840
|
return await rahmi.handlePollResult(content, jid, quoted)
|
|
841
|
+
case 'GROUP_STORY':
|
|
842
|
+
return await rahmi.handleGroupStory(content, jid, quoted)
|
|
835
843
|
}
|
|
836
844
|
}
|
|
837
845
|
const fullMsg = await Utils_1.generateWAMessage(jid, content, {
|