@nuiisweety/baileys 0.1.15 → 0.1.17

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.bak CHANGED
@@ -7,7 +7,7 @@
7
7
  *Fork dari [`@whiskeysockets/baileys`](https://github.com/WhiskeySockets/Baileys) v7.0.0-rc11*
8
8
  *dikembangkan dengan sepenuh hati oleh **NuiiS4TORU***
9
9
 
10
- [![npm version](https://img.shields.io/badge/npm-0.1.9-pink?style=flat-square&logo=npm)](https://www.npmjs.com/package/@nuiisweety/baileys)
10
+ [![npm version](https://img.shields.io/badge/npm-0.1.16-pink?style=flat-square&logo=npm)](https://www.npmjs.com/package/@nuiisweety/baileys)
11
11
  [![license](https://img.shields.io/badge/license-MIT-lavender?style=flat-square)](LICENSE)
12
12
  [![based on](https://img.shields.io/badge/based%20on-@whiskeysockets%2Fbaileys-orchid?style=flat-square)](https://github.com/WhiskeySockets/Baileys)
13
13
 
@@ -5,18 +5,14 @@ import { makeCommunitiesSocket } from './communities.js';
5
5
  const _require = createRequire(import.meta.url);
6
6
  const _pkg = _require('../../package.json');
7
7
 
8
- // Kumpulan warna ANSI yang lebih lengkap dan rapi
9
8
  const C = {
10
9
  r: '\x1b[0m',
11
10
  bold: '\x1b[1m',
12
- dim: '\x1b[2m',
13
11
  cyan: '\x1b[36m',
14
12
  green: '\x1b[32m',
15
13
  yellow: '\x1b[33m',
16
14
  magenta: '\x1b[35m',
17
- blue: '\x1b[34m',
18
- bgCyan: '\x1b[46m',
19
- bgBlack: '\x1b[40m'
15
+ blue: '\x1b[34m'
20
16
  };
21
17
 
22
18
  let _bannerPrinted = false;
@@ -25,28 +21,24 @@ const printBanner = () => {
25
21
  if (_bannerPrinted) return;
26
22
  _bannerPrinted = true;
27
23
 
28
- // Desain Box Banner Premium dengan Emoji
29
- console.log(`\n${C.cyan}╭────────────────────────────────────────╮${C.r}`);
30
- console.log(`${C.cyan}│${C.r} ${C.bgCyan}${C.bgBlack}${C.bold} ⚡ BAILEYS MULTI-DEVICE ⚡ ${C.r} ${C.cyan}│${C.r}`);
31
- console.log(`${C.cyan}├────────────────────────────────────────┤${C.r}`);
32
- console.log(`${C.cyan}│${C.r} 📦 ${C.bold}Package${C.r} : ${C.cyan}@nuiisweety/baileys${C.r} ${C.cyan}│${C.r}`);
33
- console.log(`${C.cyan}│${C.r} 🏷️ ${C.bold}Version${C.r} : ${C.yellow}v${_pkg.version}${C.r} ${C.cyan}│${C.r}`);
34
- console.log(`${C.cyan}│${C.r} 👑 ${C.bold}Creator${C.r} : ${C.green}© NuiiSweety${C.r} ${C.cyan}│${C.r}`);
35
- console.log(`${C.cyan}│${C.r} 🚀 ${C.bold}NodeJS${C.r} : ${C.blue}${process.version}${r_str => process.version.length === 7 ? ' ' : ' '}${C.r} ${C.cyan}│${C.r}`);
36
- console.log(`${C.cyan}├────────────────────────────────────────┤${C.r}`);
37
- console.log(`${C.cyan}│${C.r} 💖 ${C.magenta}Terimakasih telah menggunakan library ini!${C.r} ${C.cyan}│${C.r}`);
38
- console.log(`${C.cyan}╰────────────────────────────────────────╯${C.r}\n`);
24
+ const line = `${C.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${C.r}`;
25
+
26
+ console.log(`\n${line}`);
27
+ console.log(`${C.bold} ⚡ BAILEYS MULTI-DEVICE${C.r}`);
28
+ console.log(line);
29
+ console.log(`${C.bold} Package :${C.r} @nuiisweety/baileys`);
30
+ console.log(`${C.bold} Version :${C.r} ${C.yellow}v${_pkg.version}${C.r}`);
31
+ console.log(`${C.bold} Creator :${C.r} ${C.green}© NuiiS4TORU${C.r}`);
32
+ console.log(`${C.bold} NodeJS :${C.r} ${C.blue}${process.version}${C.r}`);
33
+ console.log(line);
34
+ console.log(`${C.magenta} Terimakasih telah menggunakan library ini!${C.r}`);
35
+ console.log(`${line}\n`);
39
36
  };
40
37
 
41
- // export the last socket layer
42
38
  const makeWASocket = (config) => {
43
- const newConfig = {
44
- ...DEFAULT_CONNECTION_CONFIG,
45
- ...config
46
- };
39
+ const newConfig = { ...DEFAULT_CONNECTION_CONFIG, ...config };
47
40
  printBanner();
48
41
  return makeCommunitiesSocket(newConfig);
49
42
  };
50
43
 
51
44
  export default makeWASocket;
52
- //# sourceMappingURL=index.js.map
@@ -26,16 +26,16 @@ const printBanner = () => {
26
26
  _bannerPrinted = true;
27
27
 
28
28
  // Desain Box Banner Premium dengan Emoji
29
- console.log(`\n${C.cyan}╭──────────────────────────────────────────────────╮${C.r}`);
29
+ console.log(`\n${C.cyan}╭────────────────────────────────────────╮${C.r}`);
30
30
  console.log(`${C.cyan}│${C.r} ${C.bgCyan}${C.bgBlack}${C.bold} ⚡ BAILEYS MULTI-DEVICE ⚡ ${C.r} ${C.cyan}│${C.r}`);
31
- console.log(`${C.cyan}├──────────────────────────────────────────────────┤${C.r}`);
31
+ console.log(`${C.cyan}├────────────────────────────────────────┤${C.r}`);
32
32
  console.log(`${C.cyan}│${C.r} 📦 ${C.bold}Package${C.r} : ${C.cyan}@nuiisweety/baileys${C.r} ${C.cyan}│${C.r}`);
33
33
  console.log(`${C.cyan}│${C.r} 🏷️ ${C.bold}Version${C.r} : ${C.yellow}v${_pkg.version}${C.r} ${C.cyan}│${C.r}`);
34
34
  console.log(`${C.cyan}│${C.r} 👑 ${C.bold}Creator${C.r} : ${C.green}© NuiiSweety${C.r} ${C.cyan}│${C.r}`);
35
35
  console.log(`${C.cyan}│${C.r} 🚀 ${C.bold}NodeJS${C.r} : ${C.blue}${process.version}${r_str => process.version.length === 7 ? ' ' : ' '}${C.r} ${C.cyan}│${C.r}`);
36
- console.log(`${C.cyan}├──────────────────────────────────────────────────┤${C.r}`);
36
+ console.log(`${C.cyan}├────────────────────────────────────────┤${C.r}`);
37
37
  console.log(`${C.cyan}│${C.r} 💖 ${C.magenta}Terimakasih telah menggunakan library ini!${C.r} ${C.cyan}│${C.r}`);
38
- console.log(`${C.cyan}╰──────────────────────────────────────────────────╯${C.r}\n`);
38
+ console.log(`${C.cyan}╰────────────────────────────────────────╯${C.r}\n`);
39
39
  };
40
40
 
41
41
  // export the last socket layer
@@ -490,6 +490,7 @@ export const makeMessagesSocket = (config) => {
490
490
  to: jid,
491
491
  id: msgId,
492
492
  type: getMessageType(message),
493
+ ...(extraAttrs || {}),
493
494
  ...(additionalAttributes || {})
494
495
  },
495
496
  content: binaryNodeContent
@@ -471,7 +471,8 @@ export const makeMessagesSocket = (config) => {
471
471
  }
472
472
  await authState.keys.transaction(async () => {
473
473
  const normalizedMsg = normalizeMessageContent(message);
474
- const mediaType = getMediaType(normalizedMsg || message);
474
+ const isGroupStatusAudio = !!(message?.groupStatusMessageV2?.message?.audioMessage);
475
+ const mediaType = isGroupStatusAudio ? undefined : getMediaType(normalizedMsg || message);
475
476
  if (mediaType) {
476
477
  extraAttrs['mediatype'] = mediaType;
477
478
  }
@@ -912,7 +913,9 @@ export const makeMessagesSocket = (config) => {
912
913
  if (normalizedMessage.eventMessage) {
913
914
  return 'event';
914
915
  }
915
- if (getMediaType(normalizedMessage) !== '') {
916
+ // Audio wrapped in groupStatusMessageV2 → type "text" (Baileys behavior)
917
+ const isGroupStatusAudio = !!(message?.groupStatusMessageV2?.message?.audioMessage);
918
+ if (!isGroupStatusAudio && getMediaType(normalizedMessage) !== '') {
916
919
  return 'media';
917
920
  }
918
921
  return 'text';
@@ -104,6 +104,19 @@ export const prepareWAMessageMedia = async (message, options) => {
104
104
  logger?.info({ key: cacheableKey }, 'Preparing raw media for newsletter');
105
105
  const { filePath, fileSha256, fileLength } = await getRawMediaUploadData(uploadData.media, options.mediaTypeOverride || mediaType, logger);
106
106
  const fileSha256B64 = fileSha256.toString('base64');
107
+ // Generate thumbnail for image/video before uploading (filePath still exists)
108
+ if ((mediaType === 'image' || mediaType === 'video') && !uploadData.jpegThumbnail) {
109
+ try {
110
+ const { thumbnail, originalImageDimensions } = await generateThumbnail(filePath, mediaType, options);
111
+ uploadData.jpegThumbnail = thumbnail;
112
+ if (!uploadData.width && originalImageDimensions) {
113
+ uploadData.width = originalImageDimensions.width;
114
+ uploadData.height = originalImageDimensions.height;
115
+ }
116
+ } catch (e) {
117
+ logger?.warn({ err: e }, 'failed to generate thumbnail for newsletter media');
118
+ }
119
+ }
107
120
  const { mediaUrl, directPath } = await options.upload(filePath, {
108
121
  fileEncSha256B64: fileSha256B64,
109
122
  mediaType: mediaType,