innovators-bot2 1.0.7 → 1.0.8

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
@@ -312,7 +312,3 @@ This project is licensed under the MIT License - see the LICENSE file for detail
312
312
  ## Credits
313
313
 
314
314
  Developed by [Innovators Soft](https://facebook.com/innovatorssoft). Based on the [@itsukichan/baileys](https://github.com/itsukichann/baileys) library.
315
-
316
- ---
317
-
318
- **Keywords:** whatsapp, bot, automation, baileys, messaging, chat, nodejs, api, group-management, qr-code, client
package/example.js CHANGED
@@ -385,6 +385,7 @@ client.on('message', async msg => {
385
385
  'https://m.facebook.com/innovatorssoft'
386
386
  )
387
387
  break;
388
+
388
389
  case '!add':
389
390
  case '!remove':
390
391
  case '!promote':
package/index.js CHANGED
@@ -129,19 +129,18 @@ class WhatsAppClient extends EventEmitter {
129
129
  }
130
130
  if (this.authmethod === 'pairing' && !state.creds?.registered) {
131
131
  const phoneNumber = await question("šŸ“± Enter your WhatsApp number (with country code): ");
132
- await this.sock.requestPairingCode(phoneNumber.trim());
133
- setTimeout(() => {
134
- const code = this.sock.authState.creds?.pairingCode;
135
- if (code) {
132
+ const customeCode = "INOVATOR"
133
+ const code = await this.sock.requestPairingCode(phoneNumber.trim(), customeCode);
134
+ if (code) {
136
135
  console.log("\nšŸ”— Pair this device using this code in WhatsApp:\n");
137
- console.log(" " + code + "\n");
136
+ console.log(' ' + formatCode(code) + '\n');
138
137
  console.log("Go to WhatsApp → Linked Devices → Link with code.");
139
138
  } else {
140
139
  console.log("āŒ Pairing code not found.");
141
140
  }
142
- }, 1000);
143
141
  }
144
142
  })
143
+
145
144
  /**
146
145
  * Handle incoming messages
147
146
  * @emits WhatsAppClient#message - When a new message is received
@@ -621,6 +620,7 @@ class WhatsAppClient extends EventEmitter {
621
620
  * @returns {Promise<void>}
622
621
  * @throws {Error} If client is not connected or message sending fails
623
622
  */
623
+
624
624
  async sendAdReply(number,msg, imgpath, title, body, sourceurl) {
625
625
  if (!this.isConnected) {
626
626
  throw new Error('Client is not connected');
@@ -652,7 +652,8 @@ class WhatsAppClient extends EventEmitter {
652
652
  } catch (err) {
653
653
  console.error('Failed to send externalAdReply:', err);
654
654
  }
655
- }
655
+ }
656
+
656
657
  /**
657
658
  * Get all groups the bot is a member of
658
659
  * @returns {Promise<Array<Group>>} Array of Group instances
@@ -835,7 +836,6 @@ class WhatsAppClient extends EventEmitter {
835
836
  throw error;
836
837
  }
837
838
  }
838
-
839
839
  /**
840
840
  * Log out from WhatsApp
841
841
  * @returns {Promise<boolean>} True if logout was successful
@@ -873,6 +873,14 @@ class WhatsAppClient extends EventEmitter {
873
873
  }
874
874
  }
875
875
  }
876
+
877
+ function formatCode(code) {
878
+ if (typeof code === 'string' && code.length === 8) {
879
+ return code.slice(0, 4) + ' - ' + code.slice(4);
880
+ }
881
+ return code;
882
+ }
883
+
876
884
  module.exports = {
877
885
  WhatsAppClient: WhatsAppClient,
878
886
  Group: Group,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innovators-bot2",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {