sanka-baileyss 1.5.0 → 1.5.1
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 +26 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,17 +50,31 @@ To run the example script, download or clone the repo and then type the followin
|
|
|
50
50
|
|
|
51
51
|
Use the stable version:
|
|
52
52
|
```
|
|
53
|
-
yarn add
|
|
53
|
+
yarn add Sanka-Baileyss
|
|
54
|
+
```
|
|
55
|
+
```
|
|
56
|
+
npm install sanka-baileyss
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use package.json
|
|
60
|
+
```
|
|
61
|
+
"@whiskeysockets/baileys": "npm:sanka-baileyss@latest"
|
|
62
|
+
```
|
|
63
|
+
```
|
|
64
|
+
"@adiwajshing/baileys": "npm:sanka-baileyss@latest"
|
|
54
65
|
```
|
|
55
66
|
|
|
56
67
|
Use the edge version (no guarantee of stability, but latest fixes + features)
|
|
57
68
|
```
|
|
58
|
-
yarn add github:SankaVollereii/Sanka-
|
|
69
|
+
yarn add github:SankaVollereii/Sanka-Baileys
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
yarn add github:SankaVollereii/Sanka-Baileys
|
|
59
73
|
```
|
|
60
74
|
|
|
61
75
|
Then import your code using:
|
|
62
76
|
```ts
|
|
63
|
-
import makeWASocket from '
|
|
77
|
+
import makeWASocket from 'Sanka-Baileyss'
|
|
64
78
|
```
|
|
65
79
|
|
|
66
80
|
# Links
|
|
@@ -217,7 +231,7 @@ WhatsApp provides a multi-device API that allows Baileys to be authenticated as
|
|
|
217
231
|
> You can customize browser name if you connect with **QR-CODE**, with `Browser` constant, we have some browsers config, **see [here](https://baileys.whiskeysockets.io/types/BrowsersMap.html)**
|
|
218
232
|
|
|
219
233
|
```ts
|
|
220
|
-
import makeWASocket from '
|
|
234
|
+
import makeWASocket from 'Sanka-Baileyss'
|
|
221
235
|
|
|
222
236
|
const sanka = makeWASocket({
|
|
223
237
|
// can provide additional config here
|
|
@@ -237,7 +251,7 @@ If the connection is successful, you will see a QR code printed on your terminal
|
|
|
237
251
|
The phone number can't have `+` or `()` or `-`, only numbers, you must provide country code
|
|
238
252
|
|
|
239
253
|
```ts
|
|
240
|
-
import makeWASocket from '
|
|
254
|
+
import makeWASocket from 'Sanka-Baileyss'
|
|
241
255
|
|
|
242
256
|
const sanka = makeWASocket({
|
|
243
257
|
// can provide additional config here
|
|
@@ -310,7 +324,7 @@ You obviously don't want to keep scanning the QR code every time you want to con
|
|
|
310
324
|
|
|
311
325
|
So, you can load the credentials to log back in:
|
|
312
326
|
```ts
|
|
313
|
-
import makeWASocket, { useMultiFileAuthState } from '
|
|
327
|
+
import makeWASocket, { useMultiFileAuthState } from 'Sanka-Baileyss'
|
|
314
328
|
|
|
315
329
|
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
|
|
316
330
|
|
|
@@ -350,7 +364,7 @@ sanka.ev.on('messages.upsert', ({ messages }) => {
|
|
|
350
364
|
> This example includes basic auth storage too
|
|
351
365
|
|
|
352
366
|
```ts
|
|
353
|
-
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '
|
|
367
|
+
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from 'Sanka-Baileyss'
|
|
354
368
|
import { Boom } from '@hapi/boom'
|
|
355
369
|
|
|
356
370
|
async function connectToWhatsApp () {
|
|
@@ -391,7 +405,7 @@ connectToWhatsApp()
|
|
|
391
405
|
|
|
392
406
|
### For example if you use useSingleFileAuthState and useMongoFileAuthState
|
|
393
407
|
```ts
|
|
394
|
-
import makeWASocket, { useSingleFileAuthState, useMongoFileAuthState } from '
|
|
408
|
+
import makeWASocket, { useSingleFileAuthState, useMongoFileAuthState } from 'Sanka-Baileyss'
|
|
395
409
|
|
|
396
410
|
// Single Auth
|
|
397
411
|
const { state, saveState } = await useSingleFileAuthState('./auth_info_baileys.json')
|
|
@@ -438,9 +452,9 @@ sanka.ev.on('creds.update', saveCreds)
|
|
|
438
452
|
- By default poll votes are encrypted and handled in `messages.update`
|
|
439
453
|
```ts
|
|
440
454
|
import pino from "pino"
|
|
441
|
-
import { makeInMemoryStore, getAggregateVotesInPollMessage } from '
|
|
455
|
+
import { makeInMemoryStore, getAggregateVotesInPollMessage } from 'Sanka-Baileyss'
|
|
442
456
|
|
|
443
|
-
const logger = pino({ timestamp: () => `,"time":"${new Date().toJSON()}"` }).child({ class: "
|
|
457
|
+
const logger = pino({ timestamp: () => `,"time":"${new Date().toJSON()}"` }).child({ class: "Sanka-Baileyss" })
|
|
444
458
|
logger.level = "fatal"
|
|
445
459
|
const store = makeInMemoryStore({ logger })
|
|
446
460
|
|
|
@@ -487,7 +501,7 @@ sanka.ev.on("messages.update", async (chatUpdate) => {
|
|
|
487
501
|
It can be used as follows:
|
|
488
502
|
|
|
489
503
|
```ts
|
|
490
|
-
import makeWASocket, { makeInMemoryStore } from '
|
|
504
|
+
import makeWASocket, { makeInMemoryStore } from 'Sanka-Baileyss'
|
|
491
505
|
// the store maintains the data of the WA connection in memory
|
|
492
506
|
// can be written out to a file & read from it
|
|
493
507
|
const store = makeInMemoryStore({ })
|
|
@@ -1956,7 +1970,7 @@ await sanka.sendMessage(jid, {
|
|
|
1956
1970
|
If you want to save the media you received
|
|
1957
1971
|
```ts
|
|
1958
1972
|
import { createWriteStream } from 'fs'
|
|
1959
|
-
import { downloadMediaMessage, getContentType } from '
|
|
1973
|
+
import { downloadMediaMessage, getContentType } from 'Sanka-Baileyss'
|
|
1960
1974
|
|
|
1961
1975
|
sanka.ev.on('messages.upsert', async ({ [m] }) => {
|
|
1962
1976
|
if (!m.message) return // if there is no text or media message
|