innovators-bot2 2.0.5 → 2.0.7
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/.github/FUNDING.yml +4 -0
- package/README.md +358 -36
- package/example.js +649 -204
- package/example.mp4 +0 -0
- package/index.js +654 -117
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
# INNOVATORS SOFT WhatsApp Bot 2
|
|
2
2
|
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/innovators-bot2)
|
|
6
|
+
[](https://www.npmjs.com/package/innovators-bot2)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](https://github.com/innovatorssoft/innovators-bot2/blob/main/LICENSE)
|
|
9
|
+
[](https://discord.gg/G3RfM6FDHS)
|
|
10
|
+
|
|
3
11
|
A powerful WhatsApp client library that provides seamless integration between Baileys and WhatsApp-web.js style APIs. This library makes it easy to create WhatsApp bots and automation tools with a familiar interface.
|
|
4
12
|
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### 📊 Client Metrics & Feature Matrix
|
|
16
|
+
|
|
17
|
+
| 🚀 ENGINE & CORE | 🔐 PRIVACY & SECURITY | 🎛️ USER INTERACTION |
|
|
18
|
+
| :--- | :--- | :--- |
|
|
19
|
+
| • **Baileys v7.x.x (Multi-Device)** | • **Auto LID-to-PN Resolution** | • **Interactive Buttons V2** |
|
|
20
|
+
| • **Agnostic Session Storage** | • **Built-in Anti-Delete Protection** | • **List and Carousel Cards** |
|
|
21
|
+
| • **Automatic Auto-Reconnection** | • **Presence (Typing/Recording)** | • **Persistent Message Store** |
|
|
22
|
+
| • **Text / Media Mention Arrays** | • **Privacy Management Controls** | • **Rich AI formatting (LaTeX/Tables)** |
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
5
26
|
## Community
|
|
6
27
|
|
|
7
|
-
|
|
8
|
-
> https://discord.gg/G3RfM6FDHS
|
|
28
|
+
# Join our **[Discord Server](https://discord.gg/G3RfM6FDHS)** for support, updates, and discussions
|
|
9
29
|
|
|
10
30
|
## Features
|
|
11
31
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
- 🧩 Interactive buttons support for both text and media (URL or local file)
|
|
32
|
+
* 🚀 **Familiar API** — Easy to use, WhatsApp-web.js style high-level interface.
|
|
33
|
+
* 📱 **Multi-Device Engine** — Powered by the robust Baileys v7.x.x library.
|
|
34
|
+
* 💬 **Messaging Suite** — Full send, receive, reply, and read receipt controls.
|
|
35
|
+
* 🎭 **Message Reactions** — Add or remove emoji reactions in real-time.
|
|
36
|
+
* 📸 **Media Handling** — Native support for images, videos, audio, documents, and stickers.
|
|
37
|
+
* 👥 **Group Management** — Invite links, participant roles (promote/demote), settings, and join requests.
|
|
38
|
+
* 💾 **Message Store Cache** — Auto-saved local store with Time-to-Live (TTL) configuration.
|
|
39
|
+
* 🔄 **Auto-Reconnect** — Automated back-off connection handler.
|
|
40
|
+
* 🔐 **LID System Support** — Fully resolves Local Identifiers to Phone Numbers post-decryption.
|
|
41
|
+
* 📊 **Decrypted Poll Votes** — Real-time aggregation and vote event tracking.
|
|
42
|
+
* 🧩 **Interactive Messages** — V2 buttons, lists, copy-code, and combined Call-to-Action templates.
|
|
43
|
+
* 🤖 **Rich AI Formatting** — Meta AI-style tables, code snippets, and pre-rendered LaTeX albums.
|
|
25
44
|
|
|
26
45
|
## Installation
|
|
27
46
|
|
|
@@ -66,6 +85,11 @@ const client = new WhatsAppClient({
|
|
|
66
85
|
authmethod: authMethod
|
|
67
86
|
});
|
|
68
87
|
|
|
88
|
+
// Handle pairing code event
|
|
89
|
+
client.on('pairing-code', (code) => {
|
|
90
|
+
console.log('Pairing Code:', code)
|
|
91
|
+
})
|
|
92
|
+
|
|
69
93
|
// Handle ready event
|
|
70
94
|
client.on('connected', () => {
|
|
71
95
|
console.log('Client is ready!')
|
|
@@ -80,22 +104,45 @@ client.connect()
|
|
|
80
104
|
### 1. Basic Messaging
|
|
81
105
|
|
|
82
106
|
```javascript
|
|
107
|
+
// Determine the correct reply target (group JID for groups, sender JID for DMs)
|
|
108
|
+
const isGroupMsg = msg.isGroup;
|
|
109
|
+
const msgFrom = isGroupMsg ? msg.from : msg.sender;
|
|
110
|
+
|
|
83
111
|
// Send a text message
|
|
84
|
-
await client.sendMessage(
|
|
112
|
+
await client.sendMessage(msgFrom, 'Hello world!')
|
|
85
113
|
|
|
86
114
|
// Send a reply
|
|
87
|
-
await
|
|
88
|
-
|
|
115
|
+
await msg.reply('This is a reply message')
|
|
116
|
+
|
|
117
|
+
// Mention a specific user
|
|
118
|
+
// Use msg.sender (the person's JID), NOT msg.from (which is the group JID in groups)
|
|
119
|
+
const number = msg.sender.split('@')[0]
|
|
120
|
+
await client.sendMessage(msgFrom, {
|
|
121
|
+
type: 'text',
|
|
122
|
+
text: `Hey @${number}! How are you?`,
|
|
123
|
+
mentions: [number]
|
|
89
124
|
})
|
|
90
125
|
|
|
91
|
-
//
|
|
92
|
-
await client.sendMessage(
|
|
126
|
+
// Mention all members in a group (only works in groups)
|
|
127
|
+
await client.sendMessage(msgFrom, {
|
|
93
128
|
type: 'text',
|
|
94
|
-
text: 'Hey @
|
|
95
|
-
mentions: ['
|
|
129
|
+
text: 'Hey @all! How are you?',
|
|
130
|
+
mentions: ['@all']
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
// You can also use the explicit mentionAll flag
|
|
134
|
+
await client.sendMessage(msgFrom, {
|
|
135
|
+
type: 'text',
|
|
136
|
+
text: 'Attention everyone!',
|
|
137
|
+
mentionAll: true
|
|
96
138
|
})
|
|
97
139
|
```
|
|
98
140
|
|
|
141
|
+
> **Note on `msg.from` vs `msg.sender`:**
|
|
142
|
+
> - `msg.from` — The chat JID. For groups this is the group ID (e.g. `120363...@g.us`), for DMs it's the person's JID.
|
|
143
|
+
> - `msg.sender` — The actual person who sent the message (always a user JID like `923001234567@s.whatsapp.net`).
|
|
144
|
+
> - When mentioning a user, always use `msg.sender` (not `msg.from`) to get the correct user JID.
|
|
145
|
+
|
|
99
146
|
### Call Methods
|
|
100
147
|
|
|
101
148
|
```javascript
|
|
@@ -171,7 +218,44 @@ client.on('message-deleted', async (data) => {
|
|
|
171
218
|
});
|
|
172
219
|
```
|
|
173
220
|
|
|
174
|
-
### 5.
|
|
221
|
+
### 5. Poll Votes Decryption
|
|
222
|
+
|
|
223
|
+
Listen for real-time updates when users cast or change their votes on a poll you created. The votes are automatically decrypted, aggregated, and their internal LID JIDs are resolved to Phone Number JIDs!
|
|
224
|
+
|
|
225
|
+
```javascript
|
|
226
|
+
client.on('poll-votes-update', async (data) => {
|
|
227
|
+
console.log(`\n📊 Poll Votes Updated in ${data.jid}!`);
|
|
228
|
+
console.log('Voter who cast/updated the vote:', data.voter);
|
|
229
|
+
|
|
230
|
+
// 1. Get original poll creation details (Question, Options, etc.)
|
|
231
|
+
const pollCreation = data.pollCreationMessage;
|
|
232
|
+
if (pollCreation && pollCreation.message) {
|
|
233
|
+
const pollMessage = pollCreation.message.pollCreationMessage ||
|
|
234
|
+
pollCreation.message.pollCreationMessageV2 ||
|
|
235
|
+
pollCreation.message.pollCreationMessageV3;
|
|
236
|
+
|
|
237
|
+
if (pollMessage) {
|
|
238
|
+
console.log('Question:', pollMessage.name);
|
|
239
|
+
console.log('Options:', pollMessage.options?.map(o => o.optionName) || []);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// 2. View accumulated vote breakdown & totals
|
|
244
|
+
let totalVotesCount = 0;
|
|
245
|
+
data.pollUpdate.forEach((option) => {
|
|
246
|
+
console.log(`- ${option.name}: ${option.voters.length} vote(s) ${JSON.stringify(option.voters)}`);
|
|
247
|
+
totalVotesCount += option.voters.length;
|
|
248
|
+
});
|
|
249
|
+
console.log('Total Votes Cast:', totalVotesCount);
|
|
250
|
+
|
|
251
|
+
// 3. Find the winning option
|
|
252
|
+
const winner = data.pollUpdate.reduce((prev, current) =>
|
|
253
|
+
prev.voters.length > current.voters.length ? prev : current);
|
|
254
|
+
console.log(`Winning Option: ${winner.name} with ${winner.voters.length} vote(s)`);
|
|
255
|
+
});
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### 6. Group Management
|
|
175
259
|
|
|
176
260
|
```javascript
|
|
177
261
|
// Get all groups
|
|
@@ -264,7 +348,7 @@ await client.toggleGroupEphemeral(groupId, 86400)
|
|
|
264
348
|
await client.changeGroupAddMode(groupId, 'admin_add')
|
|
265
349
|
```
|
|
266
350
|
|
|
267
|
-
###
|
|
351
|
+
### 7. Privacy Management
|
|
268
352
|
|
|
269
353
|
```javascript
|
|
270
354
|
// Block a user
|
|
@@ -316,7 +400,7 @@ await client.updateProfileStatus('Hello World!')
|
|
|
316
400
|
await client.updateProfileName('My name')
|
|
317
401
|
```
|
|
318
402
|
|
|
319
|
-
###
|
|
403
|
+
### 8. Interactive Messages
|
|
320
404
|
|
|
321
405
|
#### Buttons
|
|
322
406
|
```javascript
|
|
@@ -409,6 +493,56 @@ await client.SendList('1234567890@s.whatsapp.net', {
|
|
|
409
493
|
});
|
|
410
494
|
```
|
|
411
495
|
|
|
496
|
+
#### Cards Messages
|
|
497
|
+
```javascript
|
|
498
|
+
// Send interactive cards
|
|
499
|
+
await client.sendcards('1234567890@s.whatsapp.net', {
|
|
500
|
+
text: 'Body Message',
|
|
501
|
+
title: 'Title Message',
|
|
502
|
+
subtile: 'Subtitle Message',
|
|
503
|
+
footer: 'Footer Message',
|
|
504
|
+
cards: [
|
|
505
|
+
{
|
|
506
|
+
image: { url: 'https://example.com/image1.jpg' }, // or buffer
|
|
507
|
+
title: 'Title Card 1',
|
|
508
|
+
body: 'Body Card 1',
|
|
509
|
+
footer: 'Footer Card 1',
|
|
510
|
+
buttons: [
|
|
511
|
+
{
|
|
512
|
+
name: 'quick_reply',
|
|
513
|
+
buttonParamsJson: JSON.stringify({
|
|
514
|
+
display_text: 'Button 1',
|
|
515
|
+
id: 'id1'
|
|
516
|
+
})
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: 'cta_url',
|
|
520
|
+
buttonParamsJson: JSON.stringify({
|
|
521
|
+
display_text: 'Open Link',
|
|
522
|
+
url: 'https://www.example.com'
|
|
523
|
+
})
|
|
524
|
+
}
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
video: { url: 'https://example.com/video1.mp4' }, // or buffer
|
|
529
|
+
title: 'Title Card 2',
|
|
530
|
+
body: 'Body Card 2',
|
|
531
|
+
footer: 'Footer Card 2',
|
|
532
|
+
buttons: [
|
|
533
|
+
{
|
|
534
|
+
name: 'quick_reply',
|
|
535
|
+
buttonParamsJson: JSON.stringify({
|
|
536
|
+
display_text: 'Button 2',
|
|
537
|
+
id: 'id2'
|
|
538
|
+
})
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
});
|
|
544
|
+
```
|
|
545
|
+
|
|
412
546
|
#### Interactive Messages (V2)
|
|
413
547
|
|
|
414
548
|
Modern interactive message generation with simplified API.
|
|
@@ -462,7 +596,121 @@ await client.sendListV2(jid, {
|
|
|
462
596
|
});
|
|
463
597
|
```
|
|
464
598
|
|
|
465
|
-
###
|
|
599
|
+
### 9. Rich AI Messaging
|
|
600
|
+
|
|
601
|
+
Send Meta AI-style formatted responses like tables, lists, syntax-highlighted code blocks, and LaTeX expressions.
|
|
602
|
+
|
|
603
|
+
#### Send a Table
|
|
604
|
+
```javascript
|
|
605
|
+
await client.sendTable(
|
|
606
|
+
jid,
|
|
607
|
+
'Price List',
|
|
608
|
+
['Item', 'Qty', 'Price'],
|
|
609
|
+
[
|
|
610
|
+
['Apple', '3', '$1.50'],
|
|
611
|
+
['Banana', '6', '$0.90']
|
|
612
|
+
],
|
|
613
|
+
msg.raw, // quoted message
|
|
614
|
+
{ headerText: 'Order Summary:', footer: 'Thank you!' }
|
|
615
|
+
);
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
#### Send a Rich List
|
|
619
|
+
```javascript
|
|
620
|
+
await client.sendRichList(
|
|
621
|
+
jid,
|
|
622
|
+
'Available Commands',
|
|
623
|
+
['!help', '!ping', '!menu', '!info'],
|
|
624
|
+
msg.raw, // quoted message
|
|
625
|
+
{ headerText: 'Bot commands:', footer: 'Type any command' }
|
|
626
|
+
);
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
#### Send a Code Block
|
|
630
|
+
```javascript
|
|
631
|
+
await client.sendCodeBlock(
|
|
632
|
+
jid,
|
|
633
|
+
`console.log("Hello World");`,
|
|
634
|
+
msg.raw, // quoted message
|
|
635
|
+
{ title: 'Example Code', language: 'javascript' }
|
|
636
|
+
);
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
#### Send LaTeX Text
|
|
640
|
+
```javascript
|
|
641
|
+
// Note: WhatsApp clients require a pre-rendered image URL to display LaTeX graphically.
|
|
642
|
+
// This method sends the raw LaTeX text which may be invisible without an image url.
|
|
643
|
+
// The quoted message parameter can be omitted by passing the options directly.
|
|
644
|
+
await client.sendLatex(
|
|
645
|
+
jid,
|
|
646
|
+
{ text: 'Quadratic formula:', expressions: [{ latexExpression: 'x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}' }] }
|
|
647
|
+
);
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
#### Send LaTeX with Image Rendering
|
|
651
|
+
|
|
652
|
+
Render a LaTeX expression to a PNG image using the online CodeCogs API, upload, and send.
|
|
653
|
+
|
|
654
|
+
```javascript
|
|
655
|
+
// Send a LaTeX expression as an image with no caption
|
|
656
|
+
await client.sendLatexImage(jid, 'E=mc^2');
|
|
657
|
+
|
|
658
|
+
// Send a LaTeX expression with a custom caption (omitting quoted message)
|
|
659
|
+
await client.sendLatexImage(jid, {
|
|
660
|
+
formula: 'E=mc^2',
|
|
661
|
+
caption: 'Mass-Energy Equivalence'
|
|
662
|
+
});
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
#### Send LaTeX Inline Images (Album)
|
|
666
|
+
|
|
667
|
+
Render multiple LaTeX expressions as an album message.
|
|
668
|
+
|
|
669
|
+
```javascript
|
|
670
|
+
// Send LaTeX images as an album with the formula strings as captions (omitting quoted message)
|
|
671
|
+
await client.sendLatexInlineImage(jid, {
|
|
672
|
+
expressions: [
|
|
673
|
+
{ latexExpression: '\\nabla \\cdot \\mathbf{E} = \\frac{\\rho}{\\varepsilon_0}' },
|
|
674
|
+
{ latexExpression: '\\nabla \\times \\mathbf{B} = \\mu_0 \\mathbf{J} + \\mu_0\\varepsilon_0 \\frac{\\partial \\mathbf{E}}{\\partial t}' }
|
|
675
|
+
],
|
|
676
|
+
caption: true // true: formula text as caption; string: overall custom caption; false/omit: no captions
|
|
677
|
+
});
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
#### Fully Custom Rich AI Message
|
|
681
|
+
```javascript
|
|
682
|
+
await client.sendRichMessage(
|
|
683
|
+
jid,
|
|
684
|
+
[
|
|
685
|
+
{ messageType: 2, messageText: '🤖 *AI Response*' },
|
|
686
|
+
{ messageType: 5, codeMetadata: { codeLanguage: 'python', codeBlocks: [{ highlightType: 1, codeContent: 'print("Hello")' }] } }
|
|
687
|
+
],
|
|
688
|
+
msg.raw // quoted message
|
|
689
|
+
);
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
#### Send Markdown
|
|
693
|
+
```javascript
|
|
694
|
+
await client.sendMarkdown(
|
|
695
|
+
jid,
|
|
696
|
+
'# H1\n## H2\n==Highlighted==\n_Italics_ and **Bold**!',
|
|
697
|
+
msg.raw // quoted message (or null)
|
|
698
|
+
);
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
#### Send Rich Response using sendMessage
|
|
702
|
+
```javascript
|
|
703
|
+
// Text + syntax-highlighted code block
|
|
704
|
+
await client.sendMessage(jid, {
|
|
705
|
+
richResponse: {
|
|
706
|
+
text: 'Here is a JavaScript example:',
|
|
707
|
+
code: `const greet = (name) => {\n console.log('Hello, ' + name)\n}\ngreet('World')`,
|
|
708
|
+
language: 'javascript' // 'javascript' | 'typescript' | 'python' | 'js' | 'ts' | 'py'
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
### 10. Typing & Presence Control
|
|
466
714
|
|
|
467
715
|
Use `createPresenceController` for manual or standalone typing/recording presence control — without needing the auto-reply system.
|
|
468
716
|
|
|
@@ -487,7 +735,7 @@ await typing.startRecording(jid, { duration: 3000 });
|
|
|
487
735
|
await typing.stopAll();
|
|
488
736
|
```
|
|
489
737
|
|
|
490
|
-
###
|
|
738
|
+
### 11. Message History (Store)
|
|
491
739
|
|
|
492
740
|
The library includes a robust message store to keep track of chat history, even across reloads.
|
|
493
741
|
|
|
@@ -553,8 +801,64 @@ client.on('store-loaded', (info) => {
|
|
|
553
801
|
console.log(`Loaded ${info.messageCount} messages from file`);
|
|
554
802
|
});
|
|
555
803
|
```
|
|
804
|
+
|
|
805
|
+
### 12. Status / Story Posting
|
|
806
|
+
|
|
807
|
+
Post text, image, video, and voice note statuses easily using the `sendStatus` method.
|
|
808
|
+
|
|
809
|
+
| Feature | Description |
|
|
810
|
+
|---------|-------------|
|
|
811
|
+
| **Multi-Device Support** | Automatically handles `statusJidList` for correct visibility |
|
|
812
|
+
| **All Media Types** | Supports Text, Image, Video, GIF, and Voice Note statuses |
|
|
813
|
+
| **Rich Customization** | Supports backgrounds, fonts, and colors for text status |
|
|
814
|
+
|
|
815
|
+
#### Sending Text Status
|
|
816
|
+
```javascript
|
|
817
|
+
await client.sendStatus({
|
|
818
|
+
text: 'Hello from Innovators Soft! 🌍',
|
|
819
|
+
backgroundColor: '#34B7F1', // Hex color
|
|
820
|
+
font: 2, // Norican font (0-9)
|
|
821
|
+
textColor: '#FFFFFF'
|
|
822
|
+
}, ['1234567890@s.whatsapp.net']);
|
|
556
823
|
```
|
|
557
824
|
|
|
825
|
+
#### Sending Media Status
|
|
826
|
+
```javascript
|
|
827
|
+
// Image Status
|
|
828
|
+
await client.sendStatus({
|
|
829
|
+
imagePath: './photo.jpg',
|
|
830
|
+
caption: 'Beautiful day! ☀️'
|
|
831
|
+
}, ['1234567890@s.whatsapp.net']);
|
|
832
|
+
|
|
833
|
+
// Video/GIF Status
|
|
834
|
+
await client.sendStatus({
|
|
835
|
+
videoPath: './video.mp4',
|
|
836
|
+
caption: 'Check this out! 🎬',
|
|
837
|
+
isGif: true
|
|
838
|
+
}, ['1234567890@s.whatsapp.net']);
|
|
839
|
+
|
|
840
|
+
// Voice Note Status
|
|
841
|
+
await client.sendStatus({
|
|
842
|
+
audioPath: './voice.ogg'
|
|
843
|
+
}, ['1234567890@s.whatsapp.net']);
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
#### Status Visibility
|
|
847
|
+
> [!IMPORTANT]
|
|
848
|
+
> The second parameter of `sendStatus` is an array of JIDs (contacts) who should be able to see this status. On Multi-Device WhatsApp, statuses are NOT visible to anyone unless you explicitly include them in this list.
|
|
849
|
+
|
|
850
|
+
#### Helper Utilities
|
|
851
|
+
You can also access the underlying `StatusHelper` directly:
|
|
852
|
+
```javascript
|
|
853
|
+
const { StatusHelper, STATUS_BACKGROUNDS, STATUS_FONTS } = require('@innovatorssoft/baileys');
|
|
854
|
+
|
|
855
|
+
// Generate raw status content
|
|
856
|
+
const status = StatusHelper.text('Direct usage', STATUS_BACKGROUNDS.solid.purple);
|
|
857
|
+
await StatusHelper.send(client.sock, status, ['1234567890@s.whatsapp.net']);
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
---
|
|
861
|
+
|
|
558
862
|
## More Examples and Information
|
|
559
863
|
|
|
560
864
|
For a complete working example with message handling, group management, and error handling, check out our [`example.js`](https://github.com/innovatorssoft/innovators-bot2/blob/main/example.js) file. This example includes:
|
|
@@ -577,7 +881,8 @@ The library includes example bot commands that you can use:
|
|
|
577
881
|
- `!help` - Show all available commands
|
|
578
882
|
|
|
579
883
|
### Messaging
|
|
580
|
-
- `!mention` - Mention
|
|
884
|
+
- `!mention` - Mention the sender in a message
|
|
885
|
+
- `!mentionall` - Mention all group members (groups only)
|
|
581
886
|
- `!reply` - Reply to your message
|
|
582
887
|
- `!react` - React to your message with ❤️
|
|
583
888
|
- `!read` - Mark messages as read
|
|
@@ -633,6 +938,12 @@ The library includes example bot commands that you can use:
|
|
|
633
938
|
### Interactive Messages
|
|
634
939
|
- `!buttons` - Show interactive buttons
|
|
635
940
|
- `!list` - Display a scrollable list
|
|
941
|
+
- `!quickreplyv2` - Quick reply buttons V2
|
|
942
|
+
- `!urlbuttonv2` - URL button V2
|
|
943
|
+
- `!copycodev2` - Copy code button V2
|
|
944
|
+
- `!combinedv2` - Mixed buttons V2
|
|
945
|
+
- `!listv2` - Interactive list V2
|
|
946
|
+
- `!cards` - Show interactive cards message
|
|
636
947
|
- `!logout` - Logout from current session
|
|
637
948
|
|
|
638
949
|
### 💾 Message Store
|
|
@@ -694,12 +1005,22 @@ client.on('contacts-update', (updates) => {
|
|
|
694
1005
|
```javascript
|
|
695
1006
|
// When a new message is received
|
|
696
1007
|
client.on('message', async msg => {
|
|
697
|
-
console.log('Message from:', msg.from)
|
|
698
|
-
console.log('
|
|
1008
|
+
console.log('Message from:', msg.from) // Chat JID (group or DM)
|
|
1009
|
+
console.log('Sender:', msg.sender) // Person who sent it
|
|
1010
|
+
console.log('Sender Name:', msg.raw.pushName) // Display name
|
|
1011
|
+
console.log('Message:', msg.body)
|
|
1012
|
+
console.log('Is Group:', msg.isGroup)
|
|
1013
|
+
|
|
1014
|
+
// Determine reply target: group JID for groups, sender JID for DMs
|
|
1015
|
+
const isGroupMsg = msg.isGroup;
|
|
1016
|
+
const msgFrom = isGroupMsg ? msg.from : msg.sender;
|
|
699
1017
|
|
|
700
1018
|
// Mark message as read
|
|
701
1019
|
await client.readMessage(msg.raw.key)
|
|
702
1020
|
|
|
1021
|
+
// Reply back
|
|
1022
|
+
await msg.reply('Got your message!')
|
|
1023
|
+
|
|
703
1024
|
// Handle different message types
|
|
704
1025
|
if (msg.hasMedia) {
|
|
705
1026
|
console.log('Message contains media')
|
|
@@ -815,8 +1136,6 @@ try {
|
|
|
815
1136
|
}
|
|
816
1137
|
```
|
|
817
1138
|
|
|
818
|
-
## Baileys v7.x.x LID Store Implementation
|
|
819
|
-
|
|
820
1139
|
### Overview
|
|
821
1140
|
|
|
822
1141
|
This library fully supports Baileys v7.x.x LID (Local Identifier) system for enhanced privacy and WhatsApp's transition to username-based identification.
|
|
@@ -1098,12 +1417,15 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|
|
1098
1417
|
|
|
1099
1418
|
## Credits
|
|
1100
1419
|
|
|
1101
|
-
Developed by [Innovators Soft](https://
|
|
1420
|
+
Developed by [Innovators Soft](https://github.com/innovatorssoft). Based on the [@innovatorssoft/baileys](https://github.com/innovatorssoft/Baileys) library.
|
|
1102
1421
|
|
|
1103
1422
|
# Special Thanks
|
|
1104
1423
|
- [@whiskeysockets/baileys](https://github.com/whiskeysockets/Baileys)
|
|
1105
|
-
- [@
|
|
1424
|
+
- [@innovatorssoft](https://github.com/innovatorssoft)
|
|
1106
1425
|
- [All Contributors](https://github.com/innovatorssoft/Baileys/)
|
|
1107
1426
|
- [@ZenboBot](https://discordbot.innovatorssoftpk.com/) - AI Powered Baileys Bot
|
|
1108
|
-
|
|
1109
|
-
|
|
1427
|
+
## Support the Project
|
|
1428
|
+
|
|
1429
|
+
This project is completely free and open-source. If it saved you time or helped your business, consider supporting us!
|
|
1430
|
+
|
|
1431
|
+
[](https://patreon.com/innovatorssoft7)
|