Skip to content

Commit

Permalink
Update README.md (#1228)
Browse files Browse the repository at this point in the history
  • Loading branch information
purpshell authored Feb 2, 2025
1 parent b78902f commit 5f232ee
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ To run the example script, download or clone the repo and then type the followin

Use the stable version:
```
yarn add @whiskeysockets/baileys
yarn add baileys
```

Use the edge version (no guarantee of stability, but latest fixes + features)
```
yarn add github:WhiskeySockets/Baileys
```

Then import your code using:
Then import the default function in your code:
```ts
import makeWASocket from '@whiskeysockets/baileys'
import makeWASocket from 'baileys'
```

# Links
Expand Down Expand Up @@ -183,7 +183,7 @@ WhatsApp provides a multi-device API that allows Baileys to be authenticated as
> 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)**
```ts
import makeWASocket from '@whiskeysockets/baileys'
import makeWASocket from 'baileys'

const sock = makeWASocket({
// can provide additional config here
Expand All @@ -203,13 +203,13 @@ If the connection is successful, you will see a QR code printed on your terminal
The phone number can't have `+` or `()` or `-`, only numbers, you must provide country code

```ts
import makeWASocket from '@whiskeysockets/baileys'
import makeWASocket from 'baileys'

const sock = makeWASocket({
// can provide additional config here
printQRInTerminal: false //need to be false
})

// NOTE: WAIT TILL QR EVENT BEFORE REQUESTING THE PAIRING CODE
if (!sock.authState.creds.registered) {
const number = 'XXXXXXXXXXX'
const code = await sock.requestPairingCode(number)
Expand Down Expand Up @@ -276,7 +276,7 @@ You obviously don't want to keep scanning the QR code every time you want to con

So, you can load the credentials to log back in:
```ts
import makeWASocket, { useMultiFileAuthState } from '@whiskeysockets/baileys'
import makeWASocket, { useMultiFileAuthState } from 'baileys'
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
Expand Down Expand Up @@ -316,7 +316,7 @@ sock.ev.on('messages.upsert', ({ messages }) => {
> This example includes basic auth storage too

```ts
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@whiskeysockets/baileys'
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from 'baileys'
import { Boom } from '@hapi/boom'
async function connectToWhatsApp () {
Expand Down Expand Up @@ -398,7 +398,7 @@ sock.ev.on('messages.update', event => {
It can be used as follows:

```ts
import makeWASocket, { makeInMemoryStore } from '@whiskeysockets/baileys'
import makeWASocket, { makeInMemoryStore } from 'baileys'
// the store maintains the data of the WA connection in memory
// can be written out to a file & read from it
const store = makeInMemoryStore({ })
Expand Down Expand Up @@ -714,7 +714,7 @@ await sock.sendMessage(jid, {
If you want to save the media you received
```ts
import { createWriteStream } from 'fs'
import { downloadMediaMessage, getContentType } from '@whiskeysockets/baileys'
import { downloadMediaMessage, getContentType } from 'baileys'

sock.ev.on('messages.upsert', async ({ [m] }) => {
if (!m.message) return // if there is no text or media message
Expand Down

0 comments on commit 5f232ee

Please sign in to comment.