@vanzxy/baileys 1.2.8 → 1.3.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/lib/Utils/messages.js +7 -37
- package/package.json +1 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -269,7 +269,7 @@ const prepareProductMessage = async (message, options) => {
|
|
|
269
269
|
*/
|
|
270
270
|
// Lia@Changes 21-04-26 --- Enhanced prepareStickerPackMessage
|
|
271
271
|
const prepareStickerPackMessage = async (message, options) => {
|
|
272
|
-
const { cover, stickers = [], name = '📦 Sticker Pack', publisher = 'GitHub:
|
|
272
|
+
const { cover, stickers = [], name = '📦 Sticker Pack', publisher = 'GitHub: itsliaaa', description = '🏷️ itsliaaa/baileys' } = message;
|
|
273
273
|
if (stickers.length > 60) {
|
|
274
274
|
throw new Boom('Sticker pack exceeds the maximum limit of 60 stickers', { statusCode: 400 });
|
|
275
275
|
}
|
|
@@ -469,7 +469,7 @@ const prepareNativeFlowButtons = (message) => {
|
|
|
469
469
|
Object.assign(messageParamsJson, {
|
|
470
470
|
limited_time_offer: {
|
|
471
471
|
text: message.offerText || LIBRARY_NAME,
|
|
472
|
-
url: message.offerUrl || DONATE_URL
|
|
472
|
+
url: message.offerUrl || DONATE_URL, // Lia@Note 02-02-26 --- Apologies if this feels cheeky, just a fallback
|
|
473
473
|
copy_code: message.offerCode,
|
|
474
474
|
expiration_time: message.offerExpiration
|
|
475
475
|
}
|
|
@@ -795,16 +795,7 @@ export const generateForwardMessageContent = (message, forceForward) => {
|
|
|
795
795
|
content = normalizeMessageContent(content);
|
|
796
796
|
content = proto.Message.decode(proto.Message.encode(content).finish());
|
|
797
797
|
let key = Object.keys(content)[0];
|
|
798
|
-
|
|
799
|
-
// Must unwrap first before reading forwardingScore, otherwise score stays 0.
|
|
800
|
-
let innerContent = content?.[key];
|
|
801
|
-
if (key === 'viewOnceMessage' || key === 'ephemeralMessage') {
|
|
802
|
-
const innerKey = innerContent?.message ? Object.keys(innerContent.message)[0] : null;
|
|
803
|
-
if (innerKey) {
|
|
804
|
-
innerContent = innerContent.message[innerKey];
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
let score = innerContent?.contextInfo?.forwardingScore || 0;
|
|
798
|
+
let score = content?.[key]?.contextInfo?.forwardingScore || 0;
|
|
808
799
|
score += message.key.fromMe && !forceForward ? 0 : 1;
|
|
809
800
|
if (key === 'conversation') {
|
|
810
801
|
content.extendedTextMessage = { text: content[key] };
|
|
@@ -953,7 +944,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
953
944
|
else if (hasNonNullishProperty(message, 'groupInvite')) {
|
|
954
945
|
m.groupInviteMessage = {};
|
|
955
946
|
m.groupInviteMessage.inviteCode = message.groupInvite.inviteCode;
|
|
956
|
-
m.groupInviteMessage.inviteExpiration = message.groupInvite.inviteExpiration
|
|
947
|
+
m.groupInviteMessage.inviteExpiration = message.groupInvite.inviteExpiration;
|
|
957
948
|
m.groupInviteMessage.caption = message.groupInvite.text;
|
|
958
949
|
m.groupInviteMessage.groupJid = message.groupInvite.jid;
|
|
959
950
|
m.groupInviteMessage.groupName = message.groupInvite.subject;
|
|
@@ -965,24 +956,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
965
956
|
const resp = await fetch(pfpUrl, { method: 'GET', dispatcher: options?.options?.dispatcher });
|
|
966
957
|
if (resp.ok) {
|
|
967
958
|
const buf = Buffer.from(await resp.arrayBuffer());
|
|
968
|
-
|
|
969
|
-
if (options.upload) {
|
|
970
|
-
try {
|
|
971
|
-
const uploaded = await prepareWAMessageMedia({ image: buf }, { upload: options.upload });
|
|
972
|
-
if (uploaded.imageMessage) {
|
|
973
|
-
m.groupInviteMessage.jpegThumbnail = buf;
|
|
974
|
-
m.groupInviteMessage.thumbnailDirectPath = uploaded.imageMessage.directPath;
|
|
975
|
-
m.groupInviteMessage.thumbnailSha256 = uploaded.imageMessage.fileSha256;
|
|
976
|
-
m.groupInviteMessage.thumbnailEncSha256 = uploaded.imageMessage.fileEncSha256;
|
|
977
|
-
m.groupInviteMessage.mediaKey = uploaded.imageMessage.mediaKey;
|
|
978
|
-
}
|
|
979
|
-
} catch {
|
|
980
|
-
// fallback: at least attach raw jpeg
|
|
981
|
-
m.groupInviteMessage.jpegThumbnail = buf;
|
|
982
|
-
}
|
|
983
|
-
} else {
|
|
984
|
-
m.groupInviteMessage.jpegThumbnail = buf;
|
|
985
|
-
}
|
|
959
|
+
m.groupInviteMessage.jpegThumbnail = buf;
|
|
986
960
|
}
|
|
987
961
|
}
|
|
988
962
|
}
|
|
@@ -1393,6 +1367,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1393
1367
|
if (interactiveMessage.header && interactiveMessage.header.videoMessage) {
|
|
1394
1368
|
delete interactiveMessage.header.videoMessage.gifPlayback;
|
|
1395
1369
|
}
|
|
1370
|
+
}
|
|
1396
1371
|
if (hasOptionalProperty(message, 'audioFooter')) {
|
|
1397
1372
|
const { audioMessage } = await prepareWAMessageMedia({
|
|
1398
1373
|
audio: message.audioFooter
|
|
@@ -1454,11 +1429,6 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1454
1429
|
else if (hasOptionalProperty(card, 'footer')) {
|
|
1455
1430
|
carouselCard.footer = { text: card.footer };
|
|
1456
1431
|
}
|
|
1457
|
-
// Vanz@Fix (bug 20): add per-card contextInfo support
|
|
1458
|
-
// Allows each carousel card to have its own reply context, forward info, etc.
|
|
1459
|
-
if (hasNonNullishProperty(card, 'contextInfo')) {
|
|
1460
|
-
carouselCard.contextInfo = card.contextInfo;
|
|
1461
|
-
}
|
|
1462
1432
|
return carouselCard;
|
|
1463
1433
|
})),
|
|
1464
1434
|
carouselCardType: CarouselCardType.UNKNOWN,
|
|
@@ -1532,7 +1502,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1532
1502
|
throw new Boom('Thumbnail must in buffer type', { statusCode: 400 });
|
|
1533
1503
|
}
|
|
1534
1504
|
if (!content.url || typeof content.url !== 'string') {
|
|
1535
|
-
content.url = DONATE_URL
|
|
1505
|
+
content.url = DONATE_URL; // Lia@Note 02-02-26 --- Apologies if this feels cheeky, just a fallback
|
|
1536
1506
|
}
|
|
1537
1507
|
const externalAdReply = {
|
|
1538
1508
|
...content,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanzxy/baileys",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Enhanced Baileys fork by Vanzxy — based on @itsliaaa/baileys + @whiskeysockets/baileys with fixes for audio group status and clean media without newsletter button.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|