innovators-bot2 1.0.0

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 (4) hide show
  1. package/README.md +291 -0
  2. package/example.js +417 -0
  3. package/index.js +1 -0
  4. package/package.json +21 -0
package/README.md ADDED
@@ -0,0 +1,291 @@
1
+ # INNOVATORS SOFT WhatsApp Bot 2
2
+
3
+ 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
+
5
+ ## Features
6
+
7
+ - 🚀 Easy to use, familiar WhatsApp-web.js style API
8
+ - 📱 Multi-device support
9
+ - 💬 Send and receive messages
10
+ - 📸 Media handling (images, videos, documents)
11
+ - 👥 Group management
12
+ - 💾 Message history and chat management
13
+ - 🔄 Auto-reconnect functionality
14
+ - 📝 Read receipts
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install innovators-bot2
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ```javascript
25
+ const { WhatsAppClient } = require('innovators-bot2')
26
+ const qrcode = require('qrcode-terminal')
27
+
28
+ // Create client instance
29
+ const client = new WhatsAppClient({ sessionName: ".Sessions" });
30
+
31
+ // Handle QR Code
32
+ client.on('qr', qr => {
33
+ qrcode.generate(qr, { small: true })
34
+ })
35
+
36
+ // Handle ready event
37
+ client.on('connected', () => {
38
+ console.log('Client is ready!')
39
+ })
40
+
41
+ // Connect to WhatsApp
42
+ client.connect()
43
+ ```
44
+
45
+ ## Usage Examples
46
+
47
+ ### 1. Basic Messaging
48
+
49
+ ```javascript
50
+ // Send a text message
51
+ await client.sendMessage('1234567890@s.whatsapp.net', 'Hello world!')
52
+
53
+ // Send a reply
54
+ await client.sendMessage('1234567890@s.whatsapp.net', 'This is a reply', {
55
+ quoted: originalMessage
56
+ })
57
+
58
+ // Send with mentions
59
+ await client.sendMessage('1234567890@s.whatsapp.net', {
60
+ type: 'text',
61
+ text: 'Hey @user!',
62
+ mentions: ['user@s.whatsapp.net']
63
+ })
64
+ ```
65
+
66
+ ### 2. Media Handling
67
+
68
+ ```javascript
69
+ // Send an image
70
+ await client.sendMedia('1234567890@s.whatsapp.net', './image.jpg', {
71
+ caption: 'Check out this image!'
72
+ })
73
+
74
+ // Send a document
75
+ await client.sendDocument('1234567890@s.whatsapp.net', './document.pdf',
76
+ 'Check out this document!'
77
+ )
78
+ ```
79
+
80
+ ### 3. Group Management
81
+
82
+ ```javascript
83
+ // Get all groups
84
+ const groups = await client.getAllGroups()
85
+
86
+ // Add participant to group
87
+ await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'add')
88
+
89
+ // Remove participant
90
+ await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'remove')
91
+
92
+ // Promote to admin
93
+ await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'promote')
94
+
95
+ // Demote admin
96
+ await client.changeGroupParticipants(groupId, ['1234567890@s.whatsapp.net'], 'demote')
97
+ ```
98
+
99
+ ### 4. Interactive Messages
100
+
101
+ #### Buttons
102
+ ```javascript
103
+ // Send interactive buttons
104
+ await client.sendButtons('1234567890@s.whatsapp.net', {
105
+ text: 'Do you like this bot?',
106
+ title: 'Feedback',
107
+ subtitle: 'Let us know!',
108
+ footer: 'Powered by Baileys',
109
+ interactiveButtons: [
110
+ {
111
+ name: 'quick_reply',
112
+ buttonParamsJson: JSON.stringify({
113
+ display_text: '✅ Yes',
114
+ id: 'text_yes'
115
+ })
116
+ },
117
+ {
118
+ name: 'quick_reply',
119
+ buttonParamsJson: JSON.stringify({
120
+ display_text: '❌ No',
121
+ id: 'text_no'
122
+ })
123
+ }
124
+ ]
125
+ });
126
+ ```
127
+
128
+ #### List Messages
129
+ ```javascript
130
+ // Send interactive list
131
+ await client.SendList('1234567890@s.whatsapp.net', {
132
+ text: 'Please select an option:',
133
+ title: 'Main Menu',
134
+ buttonText: 'View Options',
135
+ footer: 'Scroll to see more options',
136
+ sections: [
137
+ {
138
+ title: 'Account',
139
+ rows: [
140
+ { title: 'Profile', id: 'profile', description: 'View your profile' },
141
+ { title: 'Settings', id: 'settings', description: 'Account settings' }
142
+ ]
143
+ },
144
+ {
145
+ title: 'Help',
146
+ rows: [
147
+ { title: 'Support', id: 'support', description: 'Contact support' },
148
+ { title: 'About', id: 'about', description: 'About this bot' }
149
+ ]
150
+ }
151
+ ]
152
+ });
153
+ ```
154
+
155
+ ### 4. Message History
156
+
157
+ ```javascript
158
+ // Get chat history
159
+ const messages = await client.loadMessages(chatId, 50)
160
+
161
+ // Get specific message
162
+ const message = await client.loadMessage(chatId, messageId)
163
+ ```
164
+
165
+ ## More Examples and Information
166
+
167
+ For a complete working example with message handling, group management, and error handling, check out our [`example.js`](https://github.com/Itsukichann/Baileys/blob/master/README.md) file. This example includes:
168
+
169
+ - 🔄 Connection handling and QR code generation
170
+ - 📨 Message handling with commands
171
+ - 👥 Group management examples
172
+ - ⚡ Event listeners for various scenarios
173
+ - 🛠️ Error handling and logging
174
+
175
+ Feel free to use this example as a starting point for your WhatsApp bot implementation.
176
+
177
+ ## Bot Commands
178
+
179
+ The library includes example bot commands that you can use:
180
+
181
+ ### Basic Commands
182
+ - `!ping` - Check if bot is alive
183
+ - `!echo <text>` - Echo back your text
184
+ - `!help` - Show all available commands
185
+
186
+ ### Messaging
187
+ - `!mention` - Mention you in a message
188
+ - `!reply` - Reply to your message
189
+ - `!react` - React to your message with ❤️
190
+ - `!read` - Mark messages as read
191
+ - `!typing` - Show typing indicator
192
+ - `!presence` - Set online presence
193
+
194
+ ### Media & Content
195
+ - `!media` - Send an example image
196
+ - `!doc` - Send an example document
197
+ - `!location` - Send a location
198
+ - `!contact` - Send a contact card
199
+
200
+ ### Group Management
201
+ - `!groups` - List all your groups
202
+ - `!add <number>` - Add participant to group
203
+ - `!remove <number>` - Remove participant from group
204
+ - `!promote <number>` - Promote participant to admin
205
+ - `!demote <number>` - Demote admin to participant
206
+ - `!list` - Show interactive list message
207
+
208
+ ### Interactive Messages
209
+ - `!buttons` - Show interactive buttons
210
+ - `!list` - Display a scrollable list
211
+ - `!logout` - Logout from current session
212
+
213
+ ## Event Handling
214
+
215
+ ### Connection Events
216
+ ```javascript
217
+ // When QR code is generated
218
+ client.on('qr', qr => {
219
+ qrcode.generate(qr, { small: true })
220
+ })
221
+
222
+ // When connection is established
223
+ client.on('connected', () => {
224
+ console.log('Client is ready!')
225
+ })
226
+
227
+ // When connection is in progress
228
+ client.on('connecting', (message) => {
229
+ console.log('Connection status:', message)
230
+ })
231
+
232
+ // When disconnected
233
+ client.on('disconnected', (error) => {
234
+ console.log('Client disconnected:', error)
235
+ })
236
+ ```
237
+
238
+ ### Message Events
239
+ ```javascript
240
+ // When a new message is received
241
+ client.on('message', async msg => {
242
+ console.log('Message from:', msg.from)
243
+ console.log('Message content:', msg.body)
244
+
245
+ // Mark message as read
246
+ await client.readMessage(msg.raw.key)
247
+
248
+ // Handle different message types
249
+ if (msg.hasMedia) {
250
+ console.log('Message contains media')
251
+ // Handle media message
252
+ }
253
+ })
254
+ ```
255
+
256
+ ### Error Handling
257
+
258
+ ```javascript
259
+ // Global error handler
260
+ client.on('error', error => {
261
+ console.error('Client Error:', error)
262
+ // Handle specific error types
263
+ if (error.message.includes('Connection Closed')) {
264
+ console.log('Attempting to reconnect...')
265
+ client.connect()
266
+ }
267
+ })
268
+
269
+ // Example with try-catch
270
+ try {
271
+ await client.sendMessage(to, message)
272
+ } catch (error) {
273
+ console.error('Error sending message:', error)
274
+ if (error.message.includes('Not connected')) {
275
+ console.log('Reconnecting...')
276
+ await client.connect()
277
+ }
278
+ }
279
+ ```
280
+
281
+ ## Contributing
282
+
283
+ Contributions are welcome! Please feel free to submit a Pull Request.
284
+
285
+ ## License
286
+
287
+ This project is licensed under the MIT License - see the LICENSE file for details.
288
+
289
+ ## Credits
290
+
291
+ Developed by [Innovators Soft](https://facebook.com/innovatorssoft). Based on the [@itsukichan/baileys](https://github.com/itsukichann/baileys) library.
package/example.js ADDED
@@ -0,0 +1,417 @@
1
+ const { WhatsAppClient } = require('./index')
2
+ const qrcode = require('qrcode-terminal')
3
+ const fs = require('fs');
4
+ const { text } = require('stream/consumers');
5
+
6
+ // Store logout states for different users
7
+ let logoutStates = {};
8
+
9
+ const client = new WhatsAppClient({ sessionName: ".Sessions" });
10
+
11
+ // Handle QR Code
12
+ client.on('qr', qr => {
13
+ qrcode.generate(qr, { small: true })
14
+ })
15
+
16
+ // Handle connection events
17
+ client.on('connected', () => {
18
+ console.log('Client is ready!')
19
+ })
20
+
21
+ client.on('connecting', (message) => {
22
+ console.log('Client status:', message)
23
+ })
24
+
25
+ client.on('disconnected', (error) => {
26
+ console.log('Client disconnected:', error)
27
+ })
28
+
29
+ // Connect to WhatsApp
30
+ client.connect()
31
+
32
+ // Listen for incoming messages
33
+ client.on('message', async msg => {
34
+ console.log ('Message Received');
35
+ console.log ('Number:', msg.from);
36
+ console.log ('Sender:', msg.raw.pushName);
37
+ console.log ('Message:', msg.body);
38
+ // Mark the message as read
39
+ await client.readMessage(msg.raw.key)
40
+
41
+ const command = msg.body.split(' ')[0]
42
+ const args = msg.body.split(' ').slice(1).join(' ')
43
+
44
+ switch (command) {
45
+ case '!ping':
46
+ await client.sendMessage(msg.from, 'pong')
47
+ break
48
+
49
+ case '!echo':
50
+ if (args) {
51
+ await client.sendMessage(msg.from, args)
52
+ } else {
53
+ await client.sendMessage(msg.from, 'Please provide text to echo')
54
+ }
55
+ break
56
+
57
+ case '!mention':
58
+ const number = msg.from.split('@')[0]
59
+ await client.sendMessage(msg.from, {
60
+ type: 'text',
61
+ text: `Hey @${number}! How are you?`,
62
+ mentions: [msg.from]
63
+ })
64
+ break
65
+
66
+ case '!reply':
67
+ await msg.reply('This is a reply message')
68
+ break
69
+
70
+ case '!location':
71
+ await client.sendMessage(msg.from, {
72
+ type: 'location',
73
+ latitude: 24.121231,
74
+ longitude: 55.1121221
75
+ })
76
+ break
77
+
78
+ case '!contact':
79
+ await client.sendMessage(msg.from, {
80
+ type: 'contact',
81
+ fullName: 'John Doe',
82
+ organization: 'Example Corp',
83
+ phoneNumber: '1234567890'
84
+ })
85
+ break
86
+
87
+ case '!react':
88
+ await client.sendMessage(
89
+ msg.from,
90
+ {
91
+ type: 'reaction',
92
+ emoji: '💖',
93
+ message: { key: msg.raw.key }
94
+ }
95
+ )
96
+ break
97
+ case '!media':
98
+ if (fs.existsSync('./example.jpg')) {
99
+ await client.sendMedia(msg.from, './example.jpg', {
100
+ caption: 'Check out this image!'
101
+ })
102
+ } else {
103
+ await client.sendMessage(msg.from, 'Example image not found')
104
+ }
105
+ break
106
+
107
+ case '!doc':
108
+ if (fs.existsSync('./example.pdf')) {
109
+ await client.sendDocument(msg.from, './example.pdf', 'Check out this document!')
110
+ } else {
111
+ await client.sendMessage(msg.from, 'Example document not found')
112
+ }
113
+ break
114
+
115
+ case '!list':
116
+ await client.SendList(msg.from, {
117
+ text: 'Please select an option from the list below:',
118
+ title: 'Comprehensive Menu',
119
+ buttonText: 'View All Options',
120
+ footer: 'Scroll to see more options',
121
+ sections: [
122
+ {
123
+ title: 'Main Options',
124
+ rows: [
125
+ { title: 'Account Settings', id: 'account_settings', description: 'Manage your account preferences' },
126
+ { title: 'Profile', id: 'profile', description: 'View and edit your profile' },
127
+ { title: 'Notifications', id: 'notifications', description: 'Configure notification settings' },
128
+ { title: 'Privacy', id: 'privacy', description: 'Privacy and security settings' },
129
+ { title: 'Security', id: 'security', description: 'Security and login options' },
130
+ { title: 'Payments', id: 'payments', description: 'Manage payment methods' },
131
+ { title: 'Subscriptions', id: 'subscriptions', description: 'View your subscriptions' },
132
+ { title: 'Orders', id: 'orders', description: 'View order history' },
133
+ { title: 'Wishlist', id: 'wishlist', description: 'Your saved items' },
134
+ { title: 'Addresses', id: 'addresses', description: 'Manage shipping addresses' },
135
+ { title: 'Help Center', id: 'help', description: 'Get help and support' },
136
+ { title: 'Contact Us', id: 'contact', description: 'Reach out to our team' },
137
+ { title: 'FAQs', id: 'faqs', description: 'Frequently asked questions' },
138
+ { title: 'About Us', id: 'about', description: 'Learn about our company' },
139
+ { title: 'Careers', id: 'careers', description: 'Join our team' },
140
+ { title: 'Blog', id: 'blog', description: 'Read our latest articles' },
141
+ { title: 'Newsletter', id: 'newsletter', description: 'Subscribe to updates' },
142
+ { title: 'Events', id: 'events', description: 'Upcoming events' },
143
+ { title: 'Webinars', id: 'webinars', description: 'Join live webinars' },
144
+ { title: 'Tutorials', id: 'tutorials', description: 'Learn how to use features' },
145
+ { title: 'Documentation', id: 'docs', description: 'Technical documentation' },
146
+ { title: 'API', id: 'api', description: 'Developer API' },
147
+ { title: 'Integrations', id: 'integrations', description: 'Third-party integrations' },
148
+ { title: 'Download', id: 'download', description: 'Download our app' },
149
+ { title: 'Pricing', id: 'pricing', description: 'View pricing plans' },
150
+ { title: 'Upgrade', id: 'upgrade', description: 'Upgrade your plan' },
151
+ { title: 'Refer a Friend', id: 'refer', description: 'Earn rewards' },
152
+ { title: 'Feedback', id: 'feedback', description: 'Share your thoughts' },
153
+ { title: 'Report Issue', id: 'report', description: 'Report a problem' },
154
+ { title: 'Language', id: 'language', description: 'Change language' }
155
+ ]
156
+ },
157
+ {
158
+ title: 'More Options',
159
+ rows: [
160
+ { title: 'Themes', id: 'themes', description: 'Change app appearance' },
161
+ { title: 'Font Size', id: 'font_size', description: 'Adjust text size' },
162
+ { title: 'Dark Mode', id: 'dark_mode', description: 'Toggle dark theme' },
163
+ { title: 'Offline Mode', id: 'offline', description: 'Use without internet' },
164
+ { title: 'Data Saver', id: 'data_saver', description: 'Reduce data usage' },
165
+ { title: 'Storage', id: 'storage', description: 'Manage local storage' },
166
+ { title: 'Cache', id: 'cache', description: 'Clear cached data' },
167
+ { title: 'Backup', id: 'backup', description: 'Backup your data' },
168
+ { title: 'Restore', id: 'restore', description: 'Restore from backup' },
169
+ { title: 'Export Data', id: 'export', description: 'Download your data' },
170
+ { title: 'Delete Account', id: 'delete', description: 'Permanently remove account' },
171
+ { title: 'Terms of Service', id: 'tos', description: 'Read terms and conditions' },
172
+ { title: 'Privacy Policy', id: 'privacy_policy', description: 'How we handle your data' },
173
+ { title: 'Cookie Policy', id: 'cookies', description: 'About our use of cookies' },
174
+ { title: 'Accessibility', id: 'accessibility', description: 'Accessibility features' },
175
+ { title: 'Version', id: 'version', description: 'App version information' },
176
+ { title: 'Changelog', id: 'changelog', description: 'Recent updates' },
177
+ { title: 'Roadmap', id: 'roadmap', description: 'Upcoming features' },
178
+ { title: 'Status', id: 'status', description: 'Service status' },
179
+ { title: 'Legal', id: 'legal', description: 'Legal information' },
180
+ { title: 'Partners', id: 'partners', description: 'Our partners' },
181
+ { title: 'Press', id: 'press', description: 'Press resources' },
182
+ { title: 'Investors', id: 'investors', description: 'Investor relations' },
183
+ { title: 'Affiliates', id: 'affiliates', description: 'Become an affiliate' },
184
+ { title: 'Merchandise', id: 'merch', description: 'Official merchandise' },
185
+ { title: 'Donate', id: 'donate', description: 'Support our work' },
186
+ { title: 'Volunteer', id: 'volunteer', description: 'Get involved' },
187
+ { title: 'Community', id: 'community', description: 'Join our community' },
188
+ { title: 'Forum', id: 'forum', description: 'Community discussions' },
189
+ { title: 'Beta Program', id: 'beta', description: 'Try beta features' }
190
+ ]
191
+ }
192
+ ]
193
+ })
194
+ break
195
+ case '!buttons':
196
+ // Example: Send a text interactive message (modern Baileys format)
197
+ await client.sendButtons(msg.from, {
198
+ text: 'Do you like this bot?',
199
+ title: 'Feedback',
200
+ subtitle: 'Let us know!',
201
+ footer: 'Powered by Baileys',
202
+ interactiveButtons: [
203
+ {
204
+ name: 'quick_reply',
205
+ buttonParamsJson: JSON.stringify({
206
+ display_text: '✅ Yes',
207
+ id: 'text_yes'
208
+ })
209
+ },
210
+ {
211
+ name: 'quick_reply',
212
+ buttonParamsJson: JSON.stringify({
213
+ display_text: '❌ No',
214
+ id: 'text_no'
215
+ })
216
+ }
217
+ ]
218
+ });
219
+
220
+ // Example: Send an image interactive message (modern Baileys format)
221
+
222
+ await client.sendButtons(msg.from, {
223
+ imagePath: './example.jpg',
224
+ caption: '', // Keep it short and concise
225
+ title: '', // Max 24 chars
226
+ subtitle: '', // Optional, appears below title
227
+ footer: '',
228
+ interactiveButtons: [
229
+ {
230
+ name: 'quick_reply',
231
+ buttonParamsJson: JSON.stringify({
232
+ display_text: '👍 Like',
233
+ id: 'img_like'
234
+ })
235
+ },
236
+ {
237
+ name: 'quick_reply',
238
+ buttonParamsJson: JSON.stringify({
239
+ display_text: '👎 Dislike',
240
+ id: 'img_dislike'
241
+ })
242
+ },
243
+
244
+ {
245
+ name: 'cta_call',
246
+ buttonParamsJson: JSON.stringify({
247
+ display_text: '📞 Call Us',
248
+ phone_number: '+1234567890'
249
+ })
250
+ },
251
+ {
252
+ name: 'cta_url',
253
+ buttonParamsJson: JSON.stringify({
254
+ display_text: '🌐 Visit Website',
255
+ url: 'https://example.com',
256
+ merchant_url: 'https://example.com'
257
+ })
258
+ },
259
+ {
260
+ name: 'cta_copy',
261
+ buttonParamsJson: JSON.stringify({
262
+ display_text: '🔗 Copy Link',
263
+ copy_code: 'https://example.com/copied'
264
+ })
265
+ }
266
+ ]
267
+ });
268
+ break
269
+
270
+ case '!help':
271
+ const help = `*📋 Available Commands List*\n\n` +
272
+ `*🔹 Basic Commands*\n` +
273
+ `• !ping - Check if bot is alive\n` +
274
+ `• !echo <text> - Echo back your text\n` +
275
+ `• !help - Show this command list\n\n` +
276
+
277
+ `*💬 Messaging*\n` +
278
+ `• !mention - Mention you in a message\n` +
279
+ `• !reply - Reply to your message\n` +
280
+ `• !react - React to your message with ❤️\n` +
281
+
282
+ `*🖼️ Media & Content*\n` +
283
+ `• !media - Send an example image\n` +
284
+ `• !doc - Send an example document\n` +
285
+ `• !location - Send a location\n` +
286
+ `• !contact - Send a contact card\n\n` +
287
+
288
+ `*👥 Group Management*\n` +
289
+ `• !groups - List all your groups\n` +
290
+ `• !add <number> - Add participant\n` +
291
+ `• !remove <number> - Remove participant\n` +
292
+ `• !promote <number> - Make admin\n` +
293
+ `• !demote <number> - Remove admin\n\n` +
294
+
295
+ `*🎛️ Templates & Buttons*\n` +
296
+ `• !buttons - Button template\n` +
297
+ `• !list - Scrollable list\n\n` +
298
+
299
+ `*⚙️ Admin Commands*\n` +
300
+ `• !read - Mark as read\n` +
301
+ `• !typing - Show typing\n` +
302
+ `• !presence - Set status\n` +
303
+ `• !logout - End session\n\n` +
304
+
305
+ `*📝 Note*:\nReplace <number> with phone number\n(without + or spaces)`
306
+ await client.sendMessage(msg.from, help)
307
+ break
308
+
309
+ case '!groups':
310
+ try {
311
+ const groups = await client.getAllGroups()
312
+ if (groups && groups.length > 0) {
313
+ let groupList = '*Your Groups:*\n\n'
314
+ groups.forEach((group, index) => {
315
+ groupList += `${index + 1}. *${group.subject}*\n`
316
+ groupList += ` ID: ${group.id}\n`
317
+ groupList += ` Members: ${group.participants.length}\n`
318
+ if (group.desc) groupList += ` Description: ${group.desc}\n`
319
+ groupList += '\n'
320
+ })
321
+ await client.sendMessage(msg.from, groupList)
322
+ } else {
323
+ await client.sendMessage(msg.from, 'You are not in any groups')
324
+ }
325
+ } catch (error) {
326
+ console.error('Error fetching groups:', error)
327
+ await client.sendMessage(msg.from, 'Failed to fetch groups')
328
+ }
329
+ break
330
+
331
+ case '!logout':
332
+ // Ask for confirmation before logging out
333
+ await client.sendButtons(msg.from, {
334
+ text: 'Are you sure you want to logout?',
335
+ title: 'Logout Confirmation',
336
+ footer: 'Choose Yes to logout or No to cancel',
337
+ interactiveButtons: [
338
+ {
339
+ name: 'quick_reply',
340
+ buttonParamsJson: JSON.stringify({
341
+ display_text: 'Yes',
342
+ id: 'logout_yes'
343
+ })
344
+ },
345
+ {
346
+ name: 'quick_reply',
347
+ buttonParamsJson: JSON.stringify({
348
+ display_text: 'No',
349
+ id: 'logout_no'
350
+ })
351
+ }
352
+ ]
353
+ });
354
+ break;
355
+ // Handle logout confirmation
356
+ case 'Yes':
357
+ case 'yes':
358
+ case 'logout_yes':
359
+
360
+ await client.sendMessage(msg.from, 'You have been logged out.');
361
+ await client.logout();
362
+ break;
363
+ case 'No':
364
+ case 'no':
365
+ case 'logout_no':
366
+ await client.sendMessage(msg.from, 'Logout cancelled.');
367
+ break;
368
+
369
+ case '!add':
370
+ case '!remove':
371
+ case '!promote':
372
+ case '!demote':
373
+ try {
374
+ if (!msg.raw.key.remoteJid.endsWith('@g.us')) {
375
+ await client.sendMessage(msg.from, 'This command can only be used in groups')
376
+ break
377
+ }
378
+
379
+ const number = args.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
380
+ if (!number) {
381
+ await client.sendMessage(msg.from, 'Please provide a valid phone number')
382
+ break
383
+ }
384
+
385
+ let action
386
+ switch (command) {
387
+ case '!add': action = 'add'; break
388
+ case '!remove': action = 'remove'; break
389
+ case '!promote': action = 'promote'; break
390
+ case '!demote': action = 'demote'; break
391
+ }
392
+
393
+ const result = await client.changeGroupParticipants(msg.raw.key.remoteJid, [number], action)
394
+ const actionMap = {
395
+ add: 'added to',
396
+ remove: 'removed from',
397
+ promote: 'promoted in',
398
+ demote: 'demoted in'
399
+ }
400
+
401
+ if (result[0].status === 200) {
402
+ await client.sendMessage(msg.from, `Successfully ${actionMap[action]} the group`)
403
+ } else {
404
+ await client.sendMessage(msg.from, `Failed to ${action} participant: ${result[0].content}`)
405
+ }
406
+ } catch (error) {
407
+ console.error(`Error ${command} participant:`, error)
408
+ await client.sendMessage(msg.from, `Failed to ${command.slice(1)} participant`)
409
+ }
410
+ break
411
+ }
412
+ })
413
+
414
+ // Listen for errors
415
+ client.on('error', error => {
416
+ console.error('Client Error:', error)
417
+ })
package/index.js ADDED
@@ -0,0 +1 @@
1
+ const _0x23540b=_0x5869;(function(_0x366ec8,_0x3fa27e){const _0x38a1d6=_0x5869,_0x5eae57=_0x366ec8();while(!![]){try{const _0x26f4f1=-parseInt(_0x38a1d6(0xc0))/0x1*(-parseInt(_0x38a1d6(0x95))/0x2)+parseInt(_0x38a1d6(0x7f))/0x3+-parseInt(_0x38a1d6(0xdb))/0x4*(parseInt(_0x38a1d6(0x85))/0x5)+parseInt(_0x38a1d6(0xc9))/0x6+parseInt(_0x38a1d6(0xb8))/0x7*(-parseInt(_0x38a1d6(0xcf))/0x8)+parseInt(_0x38a1d6(0x93))/0x9+parseInt(_0x38a1d6(0xff))/0xa*(-parseInt(_0x38a1d6(0x79))/0xb);if(_0x26f4f1===_0x3fa27e)break;else _0x5eae57['push'](_0x5eae57['shift']());}catch(_0x26f555){_0x5eae57['push'](_0x5eae57['shift']());}}}(_0x36ea,0xcef4d));const {makeWASocket,useMultiFileAuthState,DisconnectReason,fetchLatestBaileysVersion}=require('@itsukichan/baileys'),{EventEmitter}=require(_0x23540b(0xa3)),P=require(_0x23540b(0x8e)),fs=require('fs'),path=require('path'),mime=require(_0x23540b(0x8c));function _0x5869(_0x4624ce,_0x55dc24){const _0x36eab2=_0x36ea();return _0x5869=function(_0x586936,_0x5d21f9){_0x586936=_0x586936-0x6e;let _0x42c0af=_0x36eab2[_0x586936];return _0x42c0af;},_0x5869(_0x4624ce,_0x55dc24);}process[_0x23540b(0x7e)]='INNOVATORS\x20Soft\x20®\x20WhatsApp\x20Server\x2092\x20322\x204559543',console[_0x23540b(0x10a)](figlet[_0x23540b(0xbb)](_0x23540b(0x75))),console[_0x23540b(0x10a)](figlet[_0x23540b(0xbb)](_0x23540b(0xda))),console[_0x23540b(0x10a)](figlet[_0x23540b(0xbb)](_0x23540b(0xe6))),console[_0x23540b(0x10a)](figlet['textSync'](_0x23540b(0xae))),console[_0x23540b(0x10a)](figlet[_0x23540b(0xbb)](_0x23540b(0x6f)));class Group{constructor(_0x1ae1e3,_0x4b9930){const _0xabed32=_0x23540b;this[_0xabed32(0x9e)]=_0x1ae1e3,this['id']=_0x4b9930['id'],this[_0xabed32(0xe8)]=_0x4b9930[_0xabed32(0xe8)],this['creation']=_0x4b9930[_0xabed32(0xd2)],this[_0xabed32(0xef)]=_0x4b9930[_0xabed32(0xef)],this[_0xabed32(0xe1)]=_0x4b9930[_0xabed32(0xe1)],this[_0xabed32(0xbd)]=_0x4b9930[_0xabed32(0xbd)];}}function _0x36ea(){const _0x143dad=['user','values','interactive_buttons_modern_reply','sendDocument','key','Using\x20WA\x20version\x20v','classic_buttons','reinitialized','interactive_buttons_v3','interactiveButtons','.ogg','template_button_reply','existsSync','extname','File\x20not\x20found:\x20','34490THbssx','conversation','templateMessage','isNumberOnWhatsApp','Connecting\x20to\x20WhatsApp...','Failed\x20to\x20logout:\x20','isConnected','location','sendButtons','interactive_buttons_v3_video','reinitialize','log','join','readFileSync','Error\x20during\x20reinitialization:','min','classic_buttons_hydrated','sendMessage','BEGIN:VCARD\x0a','PAKISTANI','emoji','getAllGroups','map','.jpg','loggedOut','WELCOME\x20To','getType','3.0','fullName','6589DoDBnc','call','buttonsMessage','output','Client\x20is\x20not\x20connected','title','3561354JTRvqw','selectedButtonId','type','exports','profilePictureUrl','buttonReplyMessage','445dJMDQf','text','toLowerCase','TEL;type=CELL;type=VOICE;waid=','Invalid\x20message\x20type','.gif','messages.upsert','mime','maxReconnectAttempts','pino','rmSync','reconnectAttempts','Invalid\x20message\x20content','textMessageV3','12833316ACbjZi','Max\x20reconnection\x20attempts\x20reached.\x20Please\x20restart\x20the\x20client.','2902588GJSXUR','imageMessageV3','changeGroupParticipants','creds.update','templateButtonReplyMessage','readMessage','------------------------------------------------------------','hydratedButtons','interactiveMessage','client','Error\x20sending\x20media:','logout','Connection\x20closed.\x20Reconnecting\x20in\x20','notify','events','reply','interactive_buttons_modern_native_flow','FN:','interactiveResponseMessage','response','reconnectDelay','getSock','Error\x20sending\x20document:','end','MacOS','PRO','longitude','remoteJid','END:VCARD','Error\x20checking\x20number\x20on\x20WhatsApp:','silent','SendList','readMessages','promises','Logged\x20out.\x20Reinitializing\x20connection...','4151QgtZTQ','interactive_buttons_modern_button_reply','ORG:','textSync','connected','participants','Unsupported\x20file\x20type:\x20','buttonText','1vmOqXz','state','close','caption','Logout\x20error:','message','buttonsResponseMessage','reaction','error','4857090AJJCfe','UNKNOWN','sessionName','split','imageMessage','hydratedTemplate','11112VfVnrB','displayText','sock','creation','connecting','interactive_buttons_v3_text','videoMessageV3','pow','name','.wav','.mp4','INNOVATORS','51080SqktqQ','selectedDisplayText','contact','phoneNumber','organization','basename','desc','emit','sections','fromMe','groupParticipantsUpdate','SOFT','messages','subject','mentions','nativeFlowResponse','interactive_buttons','connect','footer','Innovators\x20Soft','owner'];_0x36ea=function(){return _0x143dad;};return _0x36ea();}class WhatsAppClient extends EventEmitter{constructor(_0x4a9140={}){const _0x1080fc=_0x23540b;super(),this[_0x1080fc(0xd1)]=null,this['isConnected']=![],this[_0x1080fc(0xcb)]=_0x4a9140[_0x1080fc(0xcb)]||'auth_info_baileys';}async[_0x23540b(0xec)](){const _0x14924a=_0x23540b;try{const {version:_0x38817b,isLatest:_0x33f8ae}=await fetchLatestBaileysVersion();console[_0x14924a(0x10a)](_0x14924a(0xf5)+_0x38817b[_0x14924a(0x10b)]('.')+',\x20is\x20latest:\x20'+_0x33f8ae);const {state:_0x331270,saveCreds:_0x3fcdad}=await useMultiFileAuthState(this[_0x14924a(0xcb)]),_0x36a2da=P({'level':_0x14924a(0xb3)});this[_0x14924a(0xd1)]=makeWASocket({'printQRInTerminal':![],'auth':_0x331270,'logger':_0x36a2da,'browser':[_0x14924a(0xee),_0x14924a(0xad),_0x14924a(0x77)]}),this['reconnectAttempts']=0x0,this[_0x14924a(0x8d)]=0x5,this[_0x14924a(0xa9)]=0x1388,this[_0x14924a(0xd1)]['ev']['on']('connection.update',async _0x18090a=>{const _0x398b52=_0x14924a,{connection:_0x5f2963,lastDisconnect:_0x2aa96a,qr:_0x44977b}=_0x18090a||{};if(_0x44977b){this[_0x398b52(0xe2)]('qr',_0x44977b);return;}if(_0x5f2963==='connecting'){this[_0x398b52(0xc1)]=_0x5f2963,this[_0x398b52(0xe2)](_0x398b52(0xd3),_0x398b52(0x103));return;}if(_0x5f2963===_0x398b52(0xc2)){this[_0x398b52(0x105)]=![];const _0x3eb697=_0x2aa96a?.['error']?.[_0x398b52(0x7c)]?.['statusCode'],_0x5efbe9='Unknown\x20error';this['emit']('disconnected',{'code':_0x3eb697||_0x398b52(0xca),'message':_0x5efbe9,'canReconnect':!![]});const _0x5f4618=_0x3eb697!==DisconnectReason[_0x398b52(0x74)];if(_0x5f4618){this['reconnectAttempts']++;const _0x3704c7=Math[_0x398b52(0x10e)](this[_0x398b52(0xa9)]*Math[_0x398b52(0xd6)](0x2,this[_0x398b52(0x90)]-0x1),0x7530);console[_0x398b52(0x10a)](_0x398b52(0xa1)+_0x3704c7/0x3e8+'\x20seconds...\x20(Attempt\x20'+this[_0x398b52(0x90)]+'/'+this[_0x398b52(0x8d)]+')'),this[_0x398b52(0x90)]<=this[_0x398b52(0x8d)]?setTimeout(()=>this[_0x398b52(0xec)](),_0x3704c7):console['log'](_0x398b52(0x94));}else _0x3eb697===DisconnectReason[_0x398b52(0x74)]&&(console[_0x398b52(0x10a)](_0x398b52(0xb7)),this[_0x398b52(0x109)]());}else{if(_0x5f2963==='open'){const _0x485de2=this[_0x398b52(0xd1)][_0x398b52(0xf0)];console[_0x398b52(0x10a)](_0x398b52(0x9b)),console[_0x398b52(0x10a)]('Scanned\x20Number:',_0x485de2[_0x398b52(0xd7)]||_0x485de2[_0x398b52(0xa2)]||_0x485de2['id'][_0x398b52(0xcc)](':')[0x0],':',_0x485de2['id'][_0x398b52(0xcc)](':')[0x0]),console['log'](_0x398b52(0x9b)),this[_0x398b52(0x105)]=!![],this[_0x398b52(0xe2)](_0x398b52(0xbc));}}}),this['sock']['ev']['on'](_0x14924a(0x8b),async _0x928bb7=>{const _0x5a783f=_0x14924a,_0x2432d4=_0x928bb7[_0x5a783f(0xe7)][0x0];if(!_0x2432d4['key'][_0x5a783f(0xe4)]&&_0x928bb7[_0x5a783f(0x81)]===_0x5a783f(0xa2)){const _0x18c52b=_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x100)]||_0x2432d4['message']?.['extendedTextMessage']?.['text']||_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0xcd)]?.[_0x5a783f(0xc3)]||_0x2432d4[_0x5a783f(0xc5)]?.['videoMessage']?.[_0x5a783f(0xc3)]||'';let _0x3b0e47=null;if(_0x2432d4['message']?.[_0x5a783f(0x7b)])_0x3b0e47=_0x5a783f(0xf6);else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x101)]?.[_0x5a783f(0xce)]?.[_0x5a783f(0x9c)])_0x3b0e47=_0x5a783f(0x10f);else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x9d)])_0x3b0e47=_0x5a783f(0xeb);else{if(_0x2432d4['message']?.[_0x5a783f(0x99)])_0x3b0e47=_0x5a783f(0xfb);else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x92)]||_0x2432d4[_0x5a783f(0xc5)]?.['imageMessageV3']||_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0xd5)]){_0x3b0e47=_0x5a783f(0xf8);const _0x421077=_0x2432d4[_0x5a783f(0xc5)][_0x5a783f(0x92)]||_0x2432d4[_0x5a783f(0xc5)][_0x5a783f(0x96)]||_0x2432d4[_0x5a783f(0xc5)][_0x5a783f(0xd5)];if(_0x421077?.[_0x5a783f(0xf9)]){}}}}}}let _0x460ef5=_0x18c52b,_0x108b5d=null;if(_0x2432d4[_0x5a783f(0xc5)]?.['buttonsResponseMessage']?.[_0x5a783f(0x80)]&&_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0xc6)]?.[_0x5a783f(0xdc)])_0x108b5d=_0x5a783f(0xf6),_0x460ef5=_0x2432d4['message'][_0x5a783f(0xc6)][_0x5a783f(0xdc)];else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x99)]?.[_0x5a783f(0xdc)])_0x108b5d=_0x5a783f(0xfb),_0x460ef5=_0x2432d4[_0x5a783f(0xc5)][_0x5a783f(0x99)][_0x5a783f(0xdc)];else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0xa7)]?.[_0x5a783f(0xea)]?.[_0x5a783f(0xa8)]?.['reply'])_0x108b5d=_0x5a783f(0xa5),_0x460ef5=_0x2432d4['message'][_0x5a783f(0xa7)][_0x5a783f(0xea)][_0x5a783f(0xa8)][_0x5a783f(0xa4)];else{if(_0x2432d4['message']?.[_0x5a783f(0xa7)]?.[_0x5a783f(0xa4)])_0x108b5d=_0x5a783f(0xf2),_0x460ef5=_0x2432d4['message']['interactiveResponseMessage'][_0x5a783f(0xa4)];else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0xa7)]?.[_0x5a783f(0x84)]?.[_0x5a783f(0xd0)])_0x108b5d=_0x5a783f(0xb9),_0x460ef5=_0x2432d4['message'][_0x5a783f(0xa7)][_0x5a783f(0x84)][_0x5a783f(0xd0)];else{if(_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x92)]?.['selectedButtonId']&&_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0x92)]?.[_0x5a783f(0xdc)])_0x108b5d=_0x5a783f(0xd4),_0x460ef5=_0x2432d4[_0x5a783f(0xc5)][_0x5a783f(0x92)][_0x5a783f(0xdc)];else{if(_0x2432d4['message']?.[_0x5a783f(0x96)]?.['selectedButtonId']&&_0x2432d4['message']?.[_0x5a783f(0x96)]?.[_0x5a783f(0xdc)])_0x108b5d='interactive_buttons_v3_image',_0x460ef5=_0x2432d4['message'][_0x5a783f(0x96)][_0x5a783f(0xdc)];else _0x2432d4[_0x5a783f(0xc5)]?.['videoMessageV3']?.['selectedButtonId']&&_0x2432d4[_0x5a783f(0xc5)]?.[_0x5a783f(0xd5)]?.['selectedDisplayText']&&(_0x108b5d=_0x5a783f(0x108),_0x460ef5=_0x2432d4[_0x5a783f(0xc5)][_0x5a783f(0xd5)][_0x5a783f(0xdc)]);}}}}}}const _0x4d0f45=this[_0x5a783f(0xd1)];this[_0x5a783f(0xe2)]('message',{'from':_0x2432d4[_0x5a783f(0xf4)][_0x5a783f(0xb0)],'id':_0x2432d4[_0x5a783f(0xf4)]['id'],'body':_0x460ef5,'buttonType':_0x108b5d,'messageType':_0x928bb7['type'],'raw':_0x2432d4,'reply':async _0x542e89=>{const _0x3a90d5=_0x5a783f;return await _0x4d0f45[_0x3a90d5(0x110)](_0x2432d4[_0x3a90d5(0xf4)]['remoteJid'],{'text':_0x542e89},{'quoted':_0x2432d4});}});}}),this[_0x14924a(0xd1)]['ev']['on']('call',async _0x207eee=>{const _0x43e32f=_0x14924a;await this['emit'](_0x43e32f(0x7a),_0x207eee);}),this[_0x14924a(0xd1)]['ev']['on'](_0x14924a(0x98),_0x3fcdad);}catch(_0x578e9f){console[_0x14924a(0xc8)]('Error\x20in\x20connect:',_0x578e9f),this[_0x14924a(0xe2)](_0x14924a(0xc8),_0x578e9f);}}async[_0x23540b(0x110)](_0x457ace,_0x1d47b4,_0x43301e={}){const _0x27c004=_0x23540b;if(!this[_0x27c004(0x105)])throw new Error('Client\x20is\x20not\x20connected');let _0x3e2743={};if(typeof _0x1d47b4==='string')_0x3e2743={'text':_0x1d47b4};else{if(_0x1d47b4['type'])switch(_0x1d47b4[_0x27c004(0x81)]){case _0x27c004(0x86):_0x3e2743={'text':_0x1d47b4[_0x27c004(0x86)]};_0x1d47b4['mentions']&&(_0x3e2743[_0x27c004(0xe9)]=_0x1d47b4[_0x27c004(0xe9)]);break;case _0x27c004(0x106):_0x3e2743={'location':{'degreesLatitude':_0x1d47b4['latitude'],'degreesLongitude':_0x1d47b4[_0x27c004(0xaf)]}};break;case _0x27c004(0xdd):const _0x3f03fe=_0x27c004(0x6e)+'VERSION:3.0\x0a'+(_0x27c004(0xa6)+_0x1d47b4[_0x27c004(0x78)]+'\x0a')+(_0x27c004(0xba)+_0x1d47b4[_0x27c004(0xdf)]+';\x0a')+(_0x27c004(0x88)+_0x1d47b4[_0x27c004(0xde)]+':+'+_0x1d47b4[_0x27c004(0xde)]+'\x0a')+_0x27c004(0xb1);_0x3e2743={'contacts':{'displayName':_0x1d47b4['fullName'],'contacts':[{'vcard':_0x3f03fe}]}};break;case _0x27c004(0xc7):_0x3e2743={'react':{'text':_0x1d47b4[_0x27c004(0x70)],'key':_0x1d47b4[_0x27c004(0xc5)]['key']}};break;default:throw new Error(_0x27c004(0x89));}else throw new Error(_0x27c004(0x91));}return await this[_0x27c004(0xd1)][_0x27c004(0x110)](_0x457ace,_0x3e2743,_0x43301e);}async['sendMedia'](_0x3a6174,_0x1aa97d,_0x1fbbee={}){const _0x414aad=_0x23540b;if(!this[_0x414aad(0x105)])throw new Error(_0x414aad(0x7d));try{if(!fs[_0x414aad(0xfc)](_0x1aa97d))throw new Error(_0x414aad(0xfe)+_0x1aa97d);const _0x455d53=path[_0x414aad(0xfd)](_0x1aa97d)[_0x414aad(0x87)](),_0x1d55fe=_0x1fbbee[_0x414aad(0xc3)]||'';let _0x2e016f={};switch(_0x455d53){case'.gif':case _0x414aad(0xd9):_0x2e016f={'video':fs[_0x414aad(0x10c)](_0x1aa97d),'caption':_0x1d55fe,'gifPlayback':_0x1fbbee['asGif']||_0x455d53===_0x414aad(0x8a)};break;case'.mp3':case _0x414aad(0xfa):case _0x414aad(0xd8):_0x2e016f={'audio':{'url':_0x1aa97d},'mimetype':'audio/mp4'};break;case _0x414aad(0x73):case'.jpeg':case'.png':_0x2e016f={'image':fs[_0x414aad(0x10c)](_0x1aa97d),'caption':_0x1d55fe};break;default:throw new Error(_0x414aad(0xbe)+_0x455d53);}return await this[_0x414aad(0xd1)][_0x414aad(0x110)](_0x3a6174,_0x2e016f);}catch(_0x37a09f){console['error'](_0x414aad(0x9f),_0x37a09f);throw _0x37a09f;}}async[_0x23540b(0xf3)](_0x2b36b0,_0x51b2a4,_0x119c54=''){const _0x6f94ec=_0x23540b;if(!this[_0x6f94ec(0x105)])throw new Error(_0x6f94ec(0x7d));try{if(!fs[_0x6f94ec(0xfc)](_0x51b2a4))throw new Error(_0x6f94ec(0xfe)+_0x51b2a4);const _0x250edc=fs['readFileSync'](_0x51b2a4),_0x132d57=path[_0x6f94ec(0xe0)](_0x51b2a4),_0x5a6738=mime[_0x6f94ec(0x76)](_0x51b2a4);return await this[_0x6f94ec(0xd1)][_0x6f94ec(0x110)](_0x2b36b0,{'document':_0x250edc,'caption':_0x119c54,'mimetype':_0x5a6738,'fileName':_0x132d57});}catch(_0x483463){console['error'](_0x6f94ec(0xab),_0x483463);throw _0x483463;}}async[_0x23540b(0x107)](_0x34ef08,_0x2777bc,_0xc33995={}){const _0x42fb75=_0x23540b;if(!this['isConnected'])throw new Error(_0x42fb75(0x7d));const {text:_0x4ceb40,imagePath:_0xdf1207,caption:_0x34492f,title:_0x2916c7,footer:_0x149279,interactiveButtons:interactiveButtons=[],hasMediaAttachment:hasMediaAttachment=![]}=_0x2777bc;let _0x4966e5={};if(_0xdf1207){const _0x16c600=fs[_0x42fb75(0x10c)](_0xdf1207);_0x4966e5={'image':_0x16c600,'caption':_0x34492f,'title':_0x2916c7,'footer':_0x149279,'interactiveButtons':interactiveButtons,'hasMediaAttachment':hasMediaAttachment};}else _0x4966e5={'text':_0x4ceb40,'title':_0x2916c7,'footer':_0x149279,'interactiveButtons':interactiveButtons};return await this[_0x42fb75(0xd1)][_0x42fb75(0x110)](_0x34ef08,_0x4966e5,_0xc33995);}async[_0x23540b(0xb4)](_0x26bf5d,_0x41feb2){const _0x298b34=_0x23540b;if(!this[_0x298b34(0x105)])throw new Error('Client\x20is\x20not\x20connected');let _0x472e78={'text':_0x41feb2[_0x298b34(0x86)],'title':_0x41feb2['title'],'footer':_0x41feb2[_0x298b34(0xed)]||'','buttonText':_0x41feb2[_0x298b34(0xbf)]||'Tap\x20here','sections':_0x41feb2[_0x298b34(0xe3)]['map'](_0x4f2865=>({'title':_0x4f2865[_0x298b34(0x7e)],'rows':_0x4f2865['rows'][_0x298b34(0x72)](_0x5778d0=>({'title':_0x5778d0[_0x298b34(0x7e)],'rowId':_0x5778d0['id'],'description':_0x5778d0['description']}))}))};return await this[_0x298b34(0xd1)][_0x298b34(0x110)](_0x26bf5d,_0x472e78);}async[_0x23540b(0x71)](){const _0x54f689=_0x23540b,_0x4fbd7c=await this[_0x54f689(0xd1)]['groupFetchAllParticipating']();return Object[_0x54f689(0xf1)](_0x4fbd7c)[_0x54f689(0x72)](_0x178846=>new Group(this,_0x178846));}async[_0x23540b(0x97)](_0x4b95f6,_0x426822,_0x466bb9){const _0x14f33c=_0x23540b,_0x141bce=[];for(const _0xd281f4 of _0x426822){const _0x255f75=await this[_0x14f33c(0xd1)][_0x14f33c(0xe5)](_0x4b95f6,[_0xd281f4],_0x466bb9);_0x141bce['push'](_0x255f75);}return _0x141bce;}async[_0x23540b(0x9a)](_0x3bf4ca){const _0x39b8e1=_0x23540b;if(!this['isConnected'])throw new Error(_0x39b8e1(0x7d));return await this['sock'][_0x39b8e1(0xb5)]([_0x3bf4ca]);}async[_0x23540b(0x102)](_0x709b8f){const _0x20cc20=_0x23540b;try{const _0x26ca9d=await this['sock']['onWhatsApp'](_0x709b8f);return _0x26ca9d['length']>0x0;}catch(_0xfc0859){console[_0x20cc20(0xc8)](_0x20cc20(0xb2),_0xfc0859);throw _0xfc0859;}}async['getProfilePicture'](_0xf8234b){const _0x16d841=_0x23540b;try{const _0x4d362d=await this[_0x16d841(0xd1)][_0x16d841(0x83)](_0xf8234b);return _0x4d362d;}catch(_0x19c4f8){console['error']('Error\x20getting\x20profile\x20picture:');return;}}async['rejectCall'](_0x28775c,_0x30592a){const _0x1e5b8e=_0x23540b;await this[_0x1e5b8e(0xd1)]['rejectCall'](_0x28775c,_0x30592a);}[_0x23540b(0xaa)](){const _0x131360=_0x23540b;return this[_0x131360(0xd1)];}async[_0x23540b(0x109)](){const _0x3e2a43=_0x23540b;try{await fs[_0x3e2a43(0xb6)]['rm'](this[_0x3e2a43(0xcb)],{'recursive':!![],'force':!![]}),this[_0x3e2a43(0x105)]=![],this[_0x3e2a43(0xd1)]=null,await this[_0x3e2a43(0xec)](),this[_0x3e2a43(0xe2)](_0x3e2a43(0xf7));}catch(_0xbc2df8){console[_0x3e2a43(0xc8)](_0x3e2a43(0x10d),_0xbc2df8),this['emit'](_0x3e2a43(0xc8),_0xbc2df8);}}async[_0x23540b(0xa0)](){const _0x488044=_0x23540b;try{return this[_0x488044(0xd1)]&&(await this[_0x488044(0xd1)][_0x488044(0xa0)](),await this['sock'][_0x488044(0xac)](),this[_0x488044(0xd1)]=null),fs[_0x488044(0xfc)](this['sessionName'])&&fs[_0x488044(0x8f)](this[_0x488044(0xcb)],{'recursive':!![],'force':!![]}),this['isConnected']=![],this['emit'](_0x488044(0xa0),'Logged\x20out\x20successfully'),!![];}catch(_0x9011b5){console[_0x488044(0xc8)](_0x488044(0xc4),_0x9011b5);throw new Error(_0x488044(0x104)+_0x9011b5['message']);}}}module[_0x23540b(0x82)]={'WhatsAppClient':WhatsAppClient,'Group':Group};
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "innovators-bot2",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "@itsukichan/baileys": "latest",
14
+ "link-preview-js": "^3.0.13",
15
+ "mime-types": "^2.1.35",
16
+ "pino": "^9.6.0",
17
+ "qrcode-terminal": "^0.12.0",
18
+ "figlet": "^1.8.0",
19
+ "mime": "^3.0.0"
20
+ }
21
+ }