lordceaser-baileys 3.4.7 → 3.4.8
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/package.json +1 -1
- package/status-extras.js +20 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lordceaser-baileys",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.8",
|
|
4
4
|
"description": "LordCeaser Baileys v1.0.2 - Cleanest WhatsApp API with Interactive Buttons, List Menus, GStatus Thumbnail Fix, Music/Video URL Import, Polls & More",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
package/status-extras.js
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
const https = require('https');
|
|
3
3
|
const http = require('http');
|
|
4
4
|
|
|
5
|
+
const PALETTE = ['#4A0E1C', '#0B3D2E', '#1B2A49', '#3D1A5C', '#5C2A0E', '#0E4A4A', '#4A1A3D', '#2B2B6B', '#5C1A1A', '#12433A'];
|
|
6
|
+
const EMOJIS = ['🔥', '✨', '💫', '🎉', '😍', '💥', '🌟', '👑', '💎', '🚀', '😎', '🥳', '🌈', '💯'];
|
|
7
|
+
const pick = (a) => a[Math.floor(Math.random() * a.length)];
|
|
8
|
+
function pickEmojis(n) {
|
|
9
|
+
const s = new Set();
|
|
10
|
+
while (s.size < n) s.add(pick(EMOJIS));
|
|
11
|
+
return [...s].join('');
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
function fetchBuf(url, hops = 0) {
|
|
6
15
|
return new Promise((resolve, reject) => {
|
|
7
16
|
const get = url.startsWith('https') ? https.get : http.get;
|
|
@@ -59,9 +68,14 @@ function attach(sock) {
|
|
|
59
68
|
const jids = [...new Set([me, ...(opts.jids || [])].map((j) =>
|
|
60
69
|
String(j).includes('@') ? String(j) : String(j).replace(/\D/g, '') + '@s.whatsapp.net'))];
|
|
61
70
|
|
|
71
|
+
const deco = opts.emojis === false ? '' : pickEmojis(2);
|
|
72
|
+
const body = opts.text ? (deco + ' ' + opts.text).trim() : deco;
|
|
73
|
+
const text = body ? body + '\n' + url : url;
|
|
74
|
+
const bg = opts.backgroundColor || (opts.randomColor === false ? '#4A0E1C' : pick(PALETTE));
|
|
75
|
+
|
|
62
76
|
const msg = lib.generateWAMessageFromContent('status@broadcast', {
|
|
63
|
-
extendedTextMessage: {
|
|
64
|
-
text
|
|
77
|
+
extendedTextMessage: Object.assign({
|
|
78
|
+
text,
|
|
65
79
|
matchedText: url,
|
|
66
80
|
canonicalUrl: url,
|
|
67
81
|
title: info.subject,
|
|
@@ -69,10 +83,11 @@ function attach(sock) {
|
|
|
69
83
|
previewType: 0,
|
|
70
84
|
jpegThumbnail,
|
|
71
85
|
inviteLinkGroupTypeV2: 0,
|
|
72
|
-
backgroundArgb: argb(
|
|
86
|
+
backgroundArgb: argb(bg, 0xff4a0e1c),
|
|
73
87
|
textArgb: 0xffffffff,
|
|
74
|
-
font: opts.font
|
|
75
|
-
|
|
88
|
+
font: opts.font != null ? opts.font : Math.floor(Math.random() * 5),
|
|
89
|
+
contextInfo: opts.contextInfo
|
|
90
|
+
}, opts.extendedFields || {})
|
|
76
91
|
}, { userJid: me });
|
|
77
92
|
|
|
78
93
|
await sock.relayMessage('status@broadcast', msg.message, {
|