wertybailz 1.0.5 → 1.0.6

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 (2) hide show
  1. package/README.md +201 -179
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,299 +1,321 @@
1
- # <div align='center'>npm:xzcbailz</div>
2
- <div align='center'>
1
+ <div align="center">
2
+
3
+ # wertybailz
4
+
5
+ [![npm version](https://img.shields.io/npm/v/wertybailz.svg?style=flat-square)](https://www.npmjs.com/package/wertybailz)
6
+ [![License](https://img.shields.io/badge/license-GPL%203-blue.svg?style=flat-square)](LICENSE)
7
+ [![Downloads](https://img.shields.io/npm/dm/wertybailz.svg?style=flat-square)](https://www.npmjs.com/package/wertybailz)
8
+
9
+ **A modern WhatsApp socket wrapper with extended messaging capabilities.**
3
10
 
4
- [![npm version](https://img.shields.io/npm/v/xzcbailz.svg)](https://www.npmjs.com/package/xzcbailz)
5
- [![License](https://img.shields.io/badge/license-GPL%203-blue.svg)](LICENSE)
6
- [![Downloads](https://img.shields.io/npm/dm/xzcbailz.svg)](https://www.npmjs.com/package/xzcbailz)
7
11
  </div>
8
12
 
9
- # Donation
10
- ## Support our development with donation
11
- **Donation QRis**
12
- ```
13
- https://files.catbox.moe/60xczp.jpg // copy ts link & scan
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install wertybailz
14
19
  ```
15
- ---
16
20
 
17
- ## Usage
21
+ Or declare in `package.json`:
22
+
18
23
  ```json
19
- "depencies": {
20
- "xzcbailz": "latest"
24
+ "dependencies": {
25
+ "wertybailz": "latest"
21
26
  }
22
27
  ```
28
+
23
29
  ## Import
30
+
24
31
  ```javascript
25
32
  const {
26
33
  default: makeWASocket,
27
- // Other functionz
28
- } = require('xzcbailz');
34
+ // other exports
35
+ } = require('wertybailz');
29
36
  ```
30
37
 
31
38
  ---
32
- # How To Connect To Whatsapp
33
- ## With QR Code
39
+
40
+ ## Connecting to WhatsApp
41
+
42
+ ### Via QR Code
43
+
34
44
  ```javascript
35
- const {
36
- default: makeWASocket
37
- } = require('xzcbailz');
45
+ const { default: makeWASocket } = require('wertybailz');
38
46
 
39
47
  const client = makeWASocket({
40
48
  browser: ['Ubuntu', 'Chrome', '20.00.1'],
41
- printQRInTerminal: true
42
- })
49
+ printQRInTerminal: true,
50
+ });
43
51
  ```
44
52
 
45
- ## Connect With Number
53
+ ### Via Pairing Code
54
+
46
55
  ```javascript
47
56
  const {
48
57
  default: makeWASocket,
49
- fetchLatestWAWebVersion
50
- } = require('xzcbailz');
58
+ fetchLatestWAWebVersion,
59
+ } = require('wertybailz');
51
60
 
52
61
  const client = makeWASocket({
53
62
  browser: ['Ubuntu', 'Chrome', '20.00.1'],
54
63
  printQRInTerminal: false,
55
- version: fetchLatestWAWebVersion()
56
- aiLabel: true // for ai label in every message are bot send
57
- // Other options
64
+ version: fetchLatestWAWebVersion(),
65
+ aiLabel: true, // attaches AI label to outgoing bot messages
58
66
  });
59
67
 
60
- const number = "628XXXXX";
61
- const code = await client.requestPairingCode(number.trim) //Use : (number, "YYYYYYYY") for custom-pairing
68
+ const number = '628XXXXXXXXX';
69
+ const code = await client.requestPairingCode(number.trim());
70
+ // For a custom pairing code: client.requestPairingCode(number, 'CUSTOMCODE')
62
71
 
63
- console.log("Ur pairing code : " + code)
72
+ console.log('Pairing code:', code);
64
73
  ```
65
74
 
66
- # Store Data
67
- ```
75
+ ---
76
+
77
+ ## Store / Session Data
78
+
79
+ ```javascript
68
80
  const {
69
81
  default: makeWASocket,
70
- makeInMemoryStore
71
- } = require('xzcbailz');
82
+ makeInMemoryStore,
83
+ } = require('wertybailz');
72
84
  const pino = require('pino');
73
85
 
74
86
  const store = makeInMemoryStore({
75
- logger: pino().child({ level: 'silent', stream: 'store' })
87
+ logger: pino().child({ level: 'silent', stream: 'store' }),
76
88
  });
77
- const client = makeWASocket({
78
- // optionz
79
- });
80
- store.bind(client.ev)
89
+
90
+ const client = makeWASocket({ /* options */ });
91
+
92
+ store.bind(client.ev);
81
93
 
82
94
  client.ev.on('contacts.upsert', () => {
83
- console.log('Get new contact: ' + Object.values(store.contacts()));
84
- })
95
+ console.log('New contacts:', Object.values(store.contacts()));
96
+ });
85
97
  ```
86
- # Sending messages
87
98
 
88
- ## send orderMessage
99
+ ---
100
+
101
+ ## Sending Messages
102
+
103
+ ### Order Message
104
+
89
105
  ```javascript
90
106
  const fs = require('fs');
91
- const ZeppImg = fs.readFileSync('./ZeppImage');
107
+ const thumbnail = fs.readFileSync('./thumbnail.png');
92
108
 
93
109
  await client.sendMessage(m.chat, {
94
- thumbnail: ZeppImg,
95
- message: "Gotta get a grip",
96
- orderTitle: "7eppeli-Corporation",
97
- totalAmount1000: 72502,
98
- totalCurrencyCode: "IDR"
99
- }, { quoted:m })
110
+ thumbnail,
111
+ message: 'Your order summary',
112
+ orderTitle: 'My Store',
113
+ totalAmount1000: 72500,
114
+ totalCurrencyCode: 'IDR',
115
+ }, { quoted: m });
100
116
  ```
101
117
 
102
- ## send pollResultSnapshotMessage
118
+ ### Poll Result Snapshot
119
+
103
120
  ```javascript
104
121
  await client.sendMessage(m.chat, {
105
122
  pollResultMessage: {
106
- name: "7eppeli-Corporation",
123
+ name: 'Survey Title',
107
124
  options: [
108
- {
109
- optionName: "poll 1"
110
- },
111
- {
112
- optionName: "poll 2"
113
- }
125
+ { optionName: 'Option A' },
126
+ { optionName: 'Option B' },
114
127
  ],
115
128
  newsletter: {
116
- newsletterName: "7eppeli | Killer Queen Information",
117
- newsletterJid: "1@newsletter"
118
- }
119
- }
120
- })
129
+ newsletterName: 'My Channel',
130
+ newsletterJid: '1@newsletter',
131
+ },
132
+ },
133
+ });
121
134
  ```
122
135
 
123
- ## send productMessage
136
+ ### Product Message
137
+
124
138
  ```javascript
125
139
  await client.relayMessage(m.chat, {
126
- productMessage {
127
- title: "7eppeli.pdf",
128
- description: "zZZ...",
129
- thumbnail: { url: "./ZeppImage" },
130
- productId: "EXAMPLE_TOKEN",
131
- retailerId: "EXAMPLE_RETAILER_ID",
132
- url: "https://t.me/YuukeyD7eppeli",
133
- body: "Nak Tido",
134
- footer: "Footer",
140
+ productMessage: {
141
+ title: 'Product Name',
142
+ description: 'Short product description.',
143
+ thumbnail: { url: './product.jpg' },
144
+ productId: 'PRODUCT_ID',
145
+ retailerId: 'RETAILER_ID',
146
+ url: 'https://example.com/product',
147
+ body: 'Body text',
148
+ footer: 'Footer text',
135
149
  buttons: [
136
150
  {
137
- name: "cta_url",
138
- buttonParamsJson: "{\"display_text\":\"7eppeli-Pdf\",\"url\":\"https://t.me/YuukeyD7eppeli\"}"
139
- }
151
+ name: 'cta_url',
152
+ buttonParamsJson: JSON.stringify({
153
+ display_text: 'View Product',
154
+ url: 'https://example.com/product',
155
+ }),
156
+ },
140
157
  ],
141
- priceAmount1000: 72502,
142
- currencyCode: "IDR"
143
- }
144
- })
158
+ priceAmount1000: 72500,
159
+ currencyCode: 'IDR',
160
+ },
161
+ });
145
162
  ```
146
163
 
147
- ## send member label
164
+ ### Group Member Label
165
+
148
166
  ```javascript
149
167
  await client.sendMessage(m.chat, {
150
168
  groupLabel: {
151
- labelText: "Tag anggota tercantum di sini"
152
- }
153
- })
169
+ labelText: 'Tag group members here',
170
+ },
171
+ });
154
172
  ```
155
173
 
156
- ## send message to members in group
174
+ ### Message to All Group Members
175
+
157
176
  ```javascript
158
177
  await client.sendMessageMembers(m.chat, {
159
178
  extendedTextMessage: {
160
- text: "save aku 7epsync"
161
- }
162
- }, {})
179
+ text: 'Hello everyone!',
180
+ },
181
+ }, {});
163
182
  ```
164
- # Simple sendMessage
165
183
 
166
- ## send text
184
+ ---
185
+
186
+ ## Simple Send Helpers
187
+
188
+ All helpers below support an optional `contextInfo` and `quoted` object.
189
+
190
+ ### Text
191
+
167
192
  ```javascript
168
- await client.sendText(m.chat, "7eppsynC", {
169
- contextInfo: {
170
- mentionedJid: [m.chat]
171
- }
193
+ await client.sendText(m.chat, 'Hello world!', {
194
+ contextInfo: { mentionedJid: [m.chat] },
172
195
  }, {
173
196
  key: {
174
- remoteJid: "status@broadcast",
197
+ remoteJid: 'status@broadcast',
175
198
  participant: m.sender,
176
- fromMe: true
199
+ fromMe: true,
177
200
  },
178
- message: {
179
- conversation: "\0"
180
- }
181
- })
201
+ message: { conversation: '\0' },
202
+ });
182
203
  ```
183
- ## send image
204
+
205
+ ### Image
206
+
184
207
  ```javascript
185
- await client.sendImage(m.chat, { url: "./zepy.jpg" }, "7eppsynC", {
186
- contextInfo: {
187
- mentionedJid: [m.chat]
188
- }
208
+ await client.sendImage(m.chat, { url: './image.jpg' }, 'Caption here', {
209
+ contextInfo: { mentionedJid: [m.chat] },
189
210
  }, {
190
211
  key: {
191
- remoteJid: "status@broadcast",
212
+ remoteJid: 'status@broadcast',
192
213
  participant: m.sender,
193
- fromMe: true
214
+ fromMe: true,
194
215
  },
195
- message: {
196
- conversation: "\0"
197
- }
198
- })
216
+ message: { conversation: '\0' },
217
+ });
199
218
  ```
200
219
 
201
- ## send video
220
+ ### Video
221
+
202
222
  ```javascript
203
- await client.sendVideo(m.chat, { url: "./zepy.mp4" }, "7eppsynC", {
204
- contextInfo: {
205
- mentionedJid: [m.chat]
206
- }
223
+ await client.sendVideo(m.chat, { url: './video.mp4' }, 'Caption here', {
224
+ contextInfo: { mentionedJid: [m.chat] },
207
225
  }, {
208
226
  key: {
209
- remoteJid: "status@broadcast",
227
+ remoteJid: 'status@broadcast',
210
228
  participant: m.sender,
211
- fromMe: true
229
+ fromMe: true,
212
230
  },
213
- message: {
214
- conversation: "\0"
215
- }
216
- })
231
+ message: { conversation: '\0' },
232
+ });
217
233
  ```
218
234
 
219
- ## send audio
235
+ ### Audio
236
+
220
237
  ```javascript
221
- await client.sendAudio(m.chat, { url: "./zepy.mp3" }, {
222
- contextInfo: {
223
- mentionedJid: [m.chat]
224
- }
238
+ await client.sendAudio(m.chat, { url: './audio.mp3' }, {
239
+ contextInfo: { mentionedJid: [m.chat] },
225
240
  }, {
226
241
  key: {
227
- remoteJid: "status@broadcast",
242
+ remoteJid: 'status@broadcast',
228
243
  participant: m.sender,
229
- fromMe: true
244
+ fromMe: true,
230
245
  },
231
- message: {
232
- conversation: "\0"
233
- }
234
- })
246
+ message: { conversation: '\0' },
247
+ });
235
248
  ```
236
249
 
237
- ## send location
250
+ ### Location
251
+
238
252
  ```javascript
239
- await client.sendLocation(m.chat, "7eppsynC", 90.0, 90.0, "https://t.me/XzC_Info", "1234567890", {
240
- contextInfo: {
241
- mentionedJid: [m.chat]
253
+ await client.sendLocation(
254
+ m.chat,
255
+ 'Location Name',
256
+ -6.2, 106.8, // latitude, longitude
257
+ 'https://maps.example.com',
258
+ '6281234567890',
259
+ { contextInfo: { mentionedJid: [m.chat] } },
260
+ {
261
+ key: {
262
+ remoteJid: 'status@broadcast',
263
+ participant: m.sender,
264
+ fromMe: true,
265
+ },
266
+ message: { conversation: '\0' },
242
267
  }
243
- }, {
244
- key: {
245
- remoteJid: "status@broadcast",
246
- participant: m.sender,
247
- fromMe: true
248
- },
249
- message: {
250
- conversation: "\0"
251
- }
252
- })
268
+ );
253
269
  ```
254
270
 
255
- ## send polling
271
+ ### Poll
272
+
256
273
  ```javascript
257
- await client.sendPoll(m.chat, "7eppsynC", ["1", "2", "3"], true, {
258
- contextInfo: {
259
- mentionedJid: [m.chat]
260
- }
274
+ await client.sendPoll(m.chat, 'Your question?', ['Option 1', 'Option 2', 'Option 3'], true, {
275
+ contextInfo: { mentionedJid: [m.chat] },
261
276
  }, {
262
277
  key: {
263
- remoteJid: "status@broadcast",
278
+ remoteJid: 'status@broadcast',
264
279
  participant: m.sender,
265
- fromMe: true
280
+ fromMe: true,
266
281
  },
267
- message: {
268
- conversation: "\0"
269
- }
270
- })
282
+ message: { conversation: '\0' },
283
+ });
271
284
  ```
272
285
 
273
- ## send quiz
286
+ ### Quiz
287
+
274
288
  ```javascript
275
- await client.sendQuiz(m.chat, "7eppsynC", ["1", "2", "3"], "2", {
276
- contextInfo: {
277
- mentionedJid: [m.chat]
289
+ await client.sendQuiz(
290
+ m.chat,
291
+ 'Which is correct?',
292
+ ['Answer A', 'Answer B', 'Answer C'],
293
+ 'Answer B', // correct answer
294
+ { contextInfo: { mentionedJid: [m.chat] } },
295
+ {
296
+ key: {
297
+ remoteJid: 'status@broadcast',
298
+ participant: m.sender,
299
+ fromMe: true,
300
+ },
301
+ message: { conversation: '\0' },
278
302
  }
279
- }, {
280
- key: {
281
- remoteJid: "status@broadcast",
282
- participant: m.sender,
283
- fromMe: true
284
- },
285
- message: {
286
- conversation: "\0"
287
- }
288
- })
303
+ );
289
304
  ```
290
305
 
291
- ## send status mention
306
+ ### Status Mention
307
+
292
308
  ```javascript
293
309
  await client.statusMention(m.chat, {
294
310
  extendedTextMessage: {
295
- text: "7eppsynC"
296
- }
297
- })
311
+ text: 'Mentioned in status!',
312
+ },
313
+ });
298
314
  ```
299
- Follow https://t.me/XzC_Information kalau mau liat type message yg lain :v
315
+
316
+ ---
317
+
318
+ ## License
319
+
320
+ [GPL-3.0](LICENSE)
321
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wertybailz",
3
3
  "type": "module",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "description": "A WebSockets library for interacting with WhatsApp Web",
6
6
  "keywords": [
7
7
  "whatsapp",