diff --git a/README.md b/README.md index 40a7eda..4a7dc75 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ 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) @@ -52,9 +52,9 @@ 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 @@ -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 @@ -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) @@ -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') @@ -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 () { @@ -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({ }) @@ -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