innovators-bot2 1.2.3 → 1.2.5
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 +113 -4
- package/example.js +591 -482
- package/index.js +265 -62
- package/package.json +7 -7
- package/LID_STORE_GUIDE.md +0 -333
- package/config.json +0 -6
package/README.md
CHANGED
|
@@ -7,7 +7,8 @@ A powerful WhatsApp client library that provides seamless integration between Ba
|
|
|
7
7
|
- 🚀 Easy to use, familiar WhatsApp-web.js style API
|
|
8
8
|
- 📱 Multi-device support (Baileys v7.x.x)
|
|
9
9
|
- 💬 Send and receive messages
|
|
10
|
-
-
|
|
10
|
+
- � Message reactions (add/remove emoji reactions)
|
|
11
|
+
- �📸 Media handling (images, videos, documents)
|
|
11
12
|
- 👥 Group management
|
|
12
13
|
- 💾 Message history and chat management
|
|
13
14
|
- 🔄 Auto-reconnect functionality
|
|
@@ -102,7 +103,43 @@ await client.sendDocument('1234567890@s.whatsapp.net', './document.pdf',
|
|
|
102
103
|
)
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
### 3.
|
|
106
|
+
### 3. Sticker Management
|
|
107
|
+
|
|
108
|
+
Create stickers easily from any image buffer with automatic conversion and metadata support.
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
const fs = require('fs');
|
|
112
|
+
|
|
113
|
+
// Send a sticker from an image or video buffer
|
|
114
|
+
const buffer = fs.readFileSync('./image.jpg');
|
|
115
|
+
await client.sendSticker('1234567890@s.whatsapp.net', buffer, {
|
|
116
|
+
packName: 'Innovators',
|
|
117
|
+
author: 'Innovators Bot',
|
|
118
|
+
type: 'full', // 'full' or 'crop'
|
|
119
|
+
quality: 50
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 4. Anti-Delete System
|
|
124
|
+
|
|
125
|
+
The library includes a built-in Anti-Delete system that tracks deleted messages in real-time.
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
// Listen for deleted messages
|
|
129
|
+
client.on('message-deleted', async (data) => {
|
|
130
|
+
console.log(`User ${data.jid} deleted a message!`);
|
|
131
|
+
|
|
132
|
+
// Content of the deleted message
|
|
133
|
+
const original = data.originalMessage;
|
|
134
|
+
|
|
135
|
+
// Reply to the chat with the deleted content
|
|
136
|
+
await client.sendMessage(data.jid, 'I saw that! 😉', {
|
|
137
|
+
quoted: original
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 5. Group Management
|
|
106
143
|
|
|
107
144
|
```javascript
|
|
108
145
|
// Get all groups
|
|
@@ -235,11 +272,17 @@ The library includes example bot commands that you can use:
|
|
|
235
272
|
- `!list` - Display a scrollable list
|
|
236
273
|
- `!logout` - Logout from current session
|
|
237
274
|
|
|
238
|
-
###
|
|
275
|
+
### 🛡️ Protection
|
|
276
|
+
- `Anti-Delete` - Automatically tracks and emits events for deleted messages
|
|
277
|
+
|
|
278
|
+
### 🔐 JID & LID/PN Management (v7.x.x)
|
|
239
279
|
- `!lid` - Get your LID (Local Identifier)
|
|
240
280
|
- `!pn <lid>` - Get phone number from a LID
|
|
281
|
+
- `!parse <jid>` - Parse detailed JID information
|
|
282
|
+
- `!normalize <number>` - Normalize a number to JID format
|
|
241
283
|
|
|
242
|
-
|
|
284
|
+
### 🎨 Sticker Commands
|
|
285
|
+
- `!sticker` - Create a sticker from an image
|
|
243
286
|
|
|
244
287
|
### Connection Events
|
|
245
288
|
```javascript
|
|
@@ -282,6 +325,72 @@ client.on('message', async msg => {
|
|
|
282
325
|
})
|
|
283
326
|
```
|
|
284
327
|
|
|
328
|
+
### Message Reaction Events
|
|
329
|
+
|
|
330
|
+
Listen for when users add or remove reactions (emojis) from messages:
|
|
331
|
+
|
|
332
|
+
```javascript
|
|
333
|
+
// When a message receives a reaction
|
|
334
|
+
client.on('message-reaction', async (reaction) => {
|
|
335
|
+
console.log('Reaction received!')
|
|
336
|
+
console.log('Chat:', reaction.from)
|
|
337
|
+
console.log('Sender:', reaction.sender)
|
|
338
|
+
console.log('Emoji:', reaction.emoji)
|
|
339
|
+
console.log('Is removed:', reaction.isRemoved)
|
|
340
|
+
|
|
341
|
+
// Check if reaction was added or removed
|
|
342
|
+
if (reaction.isRemoved) {
|
|
343
|
+
console.log('User removed their reaction')
|
|
344
|
+
} else {
|
|
345
|
+
console.log(`User reacted with: ${reaction.emoji}`)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Access the message key that was reacted to
|
|
349
|
+
console.log('Message ID:', reaction.messageKey.id)
|
|
350
|
+
|
|
351
|
+
// For group messages, get the participant who reacted
|
|
352
|
+
if (reaction.from.endsWith('@g.us')) {
|
|
353
|
+
console.log('Participant who reacted:', reaction.sender)
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### Reaction Event Data Structure
|
|
359
|
+
|
|
360
|
+
The `message-reaction` event provides the following data:
|
|
361
|
+
|
|
362
|
+
| Property | Type | Description |
|
|
363
|
+
|----------|------|-------------|
|
|
364
|
+
| `from` | `string` | Chat JID where the reaction occurred (prefers PN over LID) |
|
|
365
|
+
| `sender` | `string` | JID of the user who reacted (in groups, this is the participant) |
|
|
366
|
+
| `participant` | `string\|null` | Original participant JID (could be LID or PN) |
|
|
367
|
+
| `participantAlt` | `string\|null` | Alternate participant JID format |
|
|
368
|
+
| `emoji` | `string\|null` | The emoji used for the reaction (null if removed) |
|
|
369
|
+
| `isRemoved` | `boolean` | `true` if the reaction was removed, `false` if added |
|
|
370
|
+
| `messageKey` | `object` | The message key object that was reacted to |
|
|
371
|
+
| `timestamp` | `Date` | When the reaction event was processed |
|
|
372
|
+
| `raw` | `object` | Raw reaction data from Baileys |
|
|
373
|
+
|
|
374
|
+
#### Sending Reactions
|
|
375
|
+
|
|
376
|
+
You can also send reactions to messages programmatically:
|
|
377
|
+
|
|
378
|
+
```javascript
|
|
379
|
+
// React to a message
|
|
380
|
+
await client.sendMessage(chatId, {
|
|
381
|
+
type: 'reaction',
|
|
382
|
+
emoji: '❤️',
|
|
383
|
+
messageKey: messageToReactTo.key
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
// Remove a reaction (send empty emoji)
|
|
387
|
+
await client.sendMessage(chatId, {
|
|
388
|
+
type: 'reaction',
|
|
389
|
+
emoji: '',
|
|
390
|
+
messageKey: messageToReactTo.key
|
|
391
|
+
})
|
|
392
|
+
```
|
|
393
|
+
|
|
285
394
|
### LID Mapping Events
|
|
286
395
|
```javascript
|
|
287
396
|
// Listen for LID/PN mapping updates
|