plogme 1.0.4 → 1.0.6

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 CHANGED
@@ -10,7 +10,7 @@
10
10
  npm install plogme
11
11
  ```
12
12
 
13
- The current package version is **1.0.4**. Use Node.js 20 or newer.
13
+ The current package version is **1.0.6**. Use Node.js 20 or newer.
14
14
 
15
15
  ## Quick start
16
16
 
@@ -474,6 +474,93 @@ sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
474
474
  })
475
475
  ```
476
476
 
477
+ ## Reporting, group history, rich HTML, and source grep
478
+
479
+ Version 1.0.6 adds the realvare-style `w:report` methods without replacing plogme's existing evidence-based `reportSpam` method. The methods use different WhatsApp IQ namespaces and should be selected according to the operation you intend to perform.
480
+
481
+ | API | Wire operation | Use |
482
+ | --- | --- | --- |
483
+ | `reportSpam(jid, messages, spamFlow, subject)` | `xmlns="spam"` → `spam_list` | Report a chat or group with message evidence. |
484
+ | `reportUser(jid, reason, waitForAckMs)` | `xmlns="w:report"` → `user` | Report one user. |
485
+ | `reportMessage(jid, messageId, reason, participantJid, waitForAckMs)` | `xmlns="w:report"` → `message` | Report one message. |
486
+ | `reportAndBlockUser(jid, reason, waitForAckMs)` | `w:report` followed by block | Report a user and then block them. |
487
+
488
+ ```js
489
+ // Existing plogme spam-list report with evidence.
490
+ await sock.reportSpam(
491
+ '1203630@g.us',
492
+ [{ id: 'ABCD1234', from: '15550001111@s.whatsapp.net', t: 1710000000 }],
493
+ 'group_info_report',
494
+ 'Example group'
495
+ )
496
+
497
+ // New direct report methods.
498
+ const acknowledged = await sock.reportUser('15550001111@s.whatsapp.net', 'spam')
499
+ const messageAcknowledged = await sock.reportMessage(
500
+ '15550001111@s.whatsapp.net', 'ABCD1234', 'harassment',
501
+ '15550001111@s.whatsapp.net'
502
+ )
503
+ await sock.reportAndBlockUser('15550001111@s.whatsapp.net', 'scam')
504
+ ```
505
+
506
+ `reportUser` and `reportMessage` return `true` when WhatsApp acknowledges the IQ request and `false` when it times out. A timeout does not prove delivery failed; the request may already have reached the server.
507
+
508
+ ### Group history sharing
509
+
510
+ `toggleGroupHistory(jid, true)` selects `ALL_MEMBER_SHARE`; passing `false` selects `ADMIN_SHARE` through the WhatsApp MEX endpoint:
511
+
512
+ ```js
513
+ await sock.toggleGroupHistory('1203630@g.us', true)
514
+ await sock.toggleGroupHistory('1203630@g.us', false)
515
+ ```
516
+
517
+ ### Two HTML transports
518
+
519
+ `sendHtmlMessage` sends the ordinary single-screen `FOAHtmlPrimitiveDemoDONOTUSE` envelope. `sendRichHtmlMessage` is the reusable transport for interactive GenAI HTML screens like tabbed games; it uses `GenAIaeacdsnwHtmlPrimitive` inside `FOAIDNixelButtonSheets` and supports multiple tabs.
520
+
521
+ ```js
522
+ await sock.sendHtmlMessage(jid, {
523
+ html: '<h1>Simple screen</h1><p>One HTML payload.</p>',
524
+ trustedSources: []
525
+ })
526
+
527
+ await sock.sendRichHtmlMessage(jid, {
528
+ title: 'Games',
529
+ url: 'https://your-domain.example',
530
+ trustedSources: ['your-domain.example'],
531
+ tabs: [
532
+ { tab_header: 'mini-app', html: '<canvas id="game"></canvas><script>/* game */</script>' },
533
+ { tab_header: 'Instructions', html: '<h2>How to play</h2><p>Tap to jump.</p>' }
534
+ ]
535
+ })
536
+ ```
537
+
538
+ The rich transport is deliberately separate because clients that render the normal HTML primitive do not necessarily open the embedded-screen/tabbed envelope the same way.
539
+
540
+ The built-in `sendSlotMachine` keeps its existing ordinary HTML transport. The attached interactive mini-app is available as `sendMiniApp`; because it uses the embedded-screen envelope, plogme configures that built-in game with the owned `pair.crysnova.link` source:
541
+
542
+ ```js
543
+ await sock.sendMiniApp(jid)
544
+ await sock.sendMiniApp(jid, { title: 'My mini-app' })
545
+ ```
546
+
547
+ The `sendRichHtmlMessage` function itself remains neutral: user-supplied screens do not inherit `pair.crysnova.link` and should provide their own `url` and `trustedSources` when those fields are needed.
548
+
549
+ ### Reusable source grep
550
+
551
+ `grepSource` is exported from `lib/Utils/index.js`, and `sock.grepCode` is available after socket creation. It returns exact relative file paths, one-based line numbers, columns, and matching source lines without invoking a shell.
552
+
553
+ ```js
554
+ const matches = sock.grepCode('sendRichHtmlMessage', { maxResults: 20 })
555
+ console.log(matches)
556
+ // [{ file: 'lib/Socket/messages-send.js', line: 2705, column: 12, text: '...' }]
557
+
558
+ const reportMatches = sock.grepCode('reportMessage', { caseSensitive: false })
559
+ const regexMatches = sock.grepCode('report(User|Message)', { regex: true, flags: 'i' })
560
+ ```
561
+
562
+ By default the search covers `lib` and `WAProto`; `includeReadme: true` also searches the README.
563
+
477
564
  ## Development
478
565
 
479
566
  ```bash
@@ -490,3 +577,71 @@ Review the included license before distributing applications built with `plogme`
490
577
  ## Support
491
578
 
492
579
  For implementation questions, include the Node.js version, `plogme` version, operating system, relevant error text, and a minimal reproducible example. Never include authentication state or private account data in an issue.
580
+
581
+
582
+ ## Ported WhatsApp Web protocol features
583
+
584
+ The bundled WAProto schema is updated to WhatsApp Web version `2.3000.1047412487`, with the generated runtime, TypeScript declarations, and connection version updated together. Selected support includes newsletter follower-invite base/V2 fields, ACP2 receive-state extraction, animated wallpaper encoding, and nested audio in sticker messages. These remain experimental and client-dependent.
585
+
586
+ ### Animated wallpaper
587
+
588
+ ```js
589
+ await sock.sendMessage(jid, {
590
+ chatTheme: {
591
+ animatedWallpaper: { id: 'wallpaper-id', dimLevel: 0.25 }
592
+ }
593
+ })
594
+ ```
595
+
596
+ ### Sticker with audio
597
+
598
+ ```js
599
+ await sock.sendMessage(jid, {
600
+ sticker: { url: './sticker.webp' },
601
+ stickerAudio: { url: './sound.ogg' }
602
+ })
603
+ ```
604
+
605
+ ### Newsletter follower invites
606
+
607
+ ```js
608
+ await sock.sendMessage(jid, {
609
+ newsletterFollowerInvite: {
610
+ newsletterJid: '123456789@newsletter',
611
+ newsletterName: 'My newsletter',
612
+ caption: 'Follow this channel'
613
+ }
614
+ })
615
+
616
+ await sock.sendMessage(jid, {
617
+ newsletterFollowerInviteMessageV2: {
618
+ newsletterJid: '123456789@newsletter',
619
+ newsletterName: 'My newsletter',
620
+ caption: 'Follow this channel'
621
+ }
622
+ })
623
+ ```
624
+
625
+ ### Device-scoped relay options
626
+
627
+ `relayMessage` supports `isSecret`, `protected`, and `me` for supported private-chat device fan-out paths. These select recipients and may add `device_fanout`; they are not encryption, access-control, or delivery guarantees and may not behave identically for groups, statuses, retries, or future clients. They are unrelated to the protobuf field `messageContextInfo.messageSecret`.
628
+
629
+ ```js
630
+ await sock.relayMessage(jid, message, {
631
+ messageId: messageId,
632
+ isSecret: true
633
+ })
634
+ ```
635
+
636
+ ### Explicit album wrapper
637
+
638
+ Albums remain parent/child wire messages: one album header is relayed first, followed by separately encrypted image/video children associated with the parent key. The receiver must group them visually. The explicit wrapper accepts typed media objects and applies a caption to the first child:
639
+
640
+ ```js
641
+ await sock.sendAlbumMessage(jid, [
642
+ { type: 'image', data: { url: './one.jpg' } },
643
+ { type: 'image', data: { url: './two.jpg' } }
644
+ ], { caption: 'Album caption' })
645
+ ```
646
+
647
+ Rich HTML and bot-forwarded messages cannot be album children; send those separately. Album grouping is still dependent on WhatsApp server/client behavior.