innovators-bot2 1.1.9 → 1.1.11

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.
Files changed (3) hide show
  1. package/example.js +24 -3
  2. package/index.js +5 -4
  3. package/package.json +1 -1
package/example.js CHANGED
@@ -336,8 +336,9 @@ client.on('message', async msg => {
336
336
 
337
337
  `*⚙️ Admin Commands*\n` +
338
338
  `• !read - Mark as read\n` +
339
- `• !typing - Show typing\n` +
340
- `• !presence - Set status\n` +
339
+ `• !typing - Show typing indicator\n` +
340
+ `• !recording - Show recording indicator\n` +
341
+ `• !paused - Clear typing or recording indicator\n` +
341
342
  `• !logout - End session\n\n` +
342
343
 
343
344
  `*📝 Note*:\nReplace <number> with phone number\n(without + or spaces)`
@@ -447,7 +448,27 @@ client.on('message', async msg => {
447
448
  'https://m.facebook.com/innovatorssoft'
448
449
  )
449
450
  break;
450
-
451
+
452
+ case '!typing':
453
+ await client.sendStateTyping(msg.from);
454
+ await client.sendMessage(msg.from, 'Typing indicator sent!');
455
+ break;
456
+
457
+ case '!recording':
458
+ await client.sendStateRecording(msg.from);
459
+ await client.sendMessage(msg.from, 'Recording indicator sent!');
460
+ break;
461
+
462
+ case '!paused':
463
+ await client.clearState(msg.from);
464
+ await client.sendMessage(msg.from, 'Stopped typing/recording indicator sent!');
465
+ break;
466
+
467
+ case '!read':
468
+ await client.readMessage(msg.raw.key);
469
+ await client.sendMessage(msg.from, 'Message marked as read!');
470
+ break;
471
+
451
472
  case '!add':
452
473
  case '!remove':
453
474
  case '!promote':
package/index.js CHANGED
@@ -96,7 +96,7 @@ class WhatsAppClient extends EventEmitter {
96
96
  }
97
97
 
98
98
  const { version, isLatest } = await fetchLatestBaileysVersion();
99
- console.log(`Using WA version v${version.join('.')}, is latest: ${isLatest}`);
99
+ //console.log(`Using WA version v${version.join('.')}, is latest: ${isLatest}`);
100
100
 
101
101
  const { state, saveCreds } = await useMultiFileAuthState(this.sessionName)
102
102
  const logger = P({ level: 'silent' })
@@ -109,6 +109,7 @@ class WhatsAppClient extends EventEmitter {
109
109
  generateHighQualityLinkPreview: true,
110
110
  linkPreviewImageThumbnailWidth: 192,
111
111
  emitOwnEvents: true,
112
+ version,
112
113
  // Implement cachedGroupMetadata to prevent rate limiting when sending messages to groups
113
114
  cachedGroupMetadata: async (jid) => {
114
115
  // Check if we have cached metadata for this group
@@ -877,7 +878,7 @@ class WhatsAppClient extends EventEmitter {
877
878
  * @param {string} jid - The JID of the chat
878
879
  * @returns {Promise<void>}
879
880
  */
880
- async sendTypingPresence(jid) {
881
+ async sendStateTyping(jid) {
881
882
  if (!this.sock) throw new Error('Not connected to WhatsApp');
882
883
  await this.sock.sendPresenceUpdate("composing", jid);
883
884
  }
@@ -887,7 +888,7 @@ class WhatsAppClient extends EventEmitter {
887
888
  * @param {string} jid - The JID of the chat
888
889
  * @returns {Promise<void>}
889
890
  */
890
- async sendRecordingPresence(jid) {
891
+ async sendStateRecording(jid) {
891
892
  if (!this.sock) throw new Error('Not connected to WhatsApp');
892
893
  await this.sock.sendPresenceUpdate("recording", jid);
893
894
  }
@@ -897,7 +898,7 @@ class WhatsAppClient extends EventEmitter {
897
898
  * @param {string} jid - The JID of the chat
898
899
  * @returns {Promise<void>}
899
900
  */
900
- async sendPausedPresence(jid) {
901
+ async clearState(jid) {
901
902
  if (!this.sock) throw new Error('Not connected to WhatsApp');
902
903
  await this.sock.sendPresenceUpdate("paused", jid);
903
904
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innovators-bot2",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {