mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
rename package to baileys-md
This commit is contained in:
16
README.md
16
README.md
@@ -31,7 +31,7 @@ yarn add github:adiwajshing/baileys#multi-device
|
|||||||
|
|
||||||
Then import in your code using:
|
Then import in your code using:
|
||||||
``` ts
|
``` ts
|
||||||
import makeWASocket from '@adiwajshing/baileys'
|
import makeWASocket from '@adiwajshing/baileys-md'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Unit Tests
|
## Unit Tests
|
||||||
@@ -41,7 +41,7 @@ TODO
|
|||||||
## Connecting
|
## Connecting
|
||||||
|
|
||||||
``` ts
|
``` ts
|
||||||
import makeWASocket from '@adiwajshing/baileys'
|
import makeWASocket from '@adiwajshing/baileys-md'
|
||||||
|
|
||||||
async function connectToWhatsApp () {
|
async function connectToWhatsApp () {
|
||||||
const conn = makeWASocket({
|
const conn = makeWASocket({
|
||||||
@@ -119,7 +119,7 @@ You obviously don't want to keep scanning the QR code every time you want to con
|
|||||||
|
|
||||||
So, you can save the credentials to log back in via:
|
So, you can save the credentials to log back in via:
|
||||||
``` ts
|
``` ts
|
||||||
import makeWASocket, { BufferJSON } from '@adiwajshing/baileys'
|
import makeWASocket, { BufferJSON } from '@adiwajshing/baileys-md'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
// will initialize a default in-memory auth session
|
// will initialize a default in-memory auth session
|
||||||
@@ -139,7 +139,7 @@ conn.ev.on ('auth-state.update', () => {
|
|||||||
|
|
||||||
Then, to restore a session:
|
Then, to restore a session:
|
||||||
``` ts
|
``` ts
|
||||||
import makeWASocket, { BufferJSON, initInMemoryKeyStore } from '@adiwajshing/baileys'
|
import makeWASocket, { BufferJSON, initInMemoryKeyStore } from '@adiwajshing/baileys-md'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
const authJSON = JSON.parse(
|
const authJSON = JSON.parse(
|
||||||
@@ -248,7 +248,7 @@ sock.ev.on('messages.upsert', ({ messages }) => {
|
|||||||
### Non-Media Messages
|
### Non-Media Messages
|
||||||
|
|
||||||
``` ts
|
``` ts
|
||||||
import { MessageType, MessageOptions, Mimetype } from '@adiwajshing/baileys'
|
import { MessageType, MessageOptions, Mimetype } from '@adiwajshing/baileys-md'
|
||||||
|
|
||||||
const id = 'abcd@s.whatsapp.net' // the WhatsApp ID
|
const id = 'abcd@s.whatsapp.net' // the WhatsApp ID
|
||||||
// send a simple text!
|
// send a simple text!
|
||||||
@@ -283,7 +283,7 @@ Sending media (video, stickers, images) is easier & more efficient than ever.
|
|||||||
- When specifying a media url, Baileys never loads the entire buffer into memory, it even encrypts the media as a readable stream.
|
- When specifying a media url, Baileys never loads the entire buffer into memory, it even encrypts the media as a readable stream.
|
||||||
|
|
||||||
``` ts
|
``` ts
|
||||||
import { MessageType, MessageOptions, Mimetype } from '@adiwajshing/baileys'
|
import { MessageType, MessageOptions, Mimetype } from '@adiwajshing/baileys-md'
|
||||||
// Sending gifs
|
// Sending gifs
|
||||||
await conn.sendMessage(
|
await conn.sendMessage(
|
||||||
id,
|
id,
|
||||||
@@ -338,7 +338,7 @@ await conn.sendMessage(
|
|||||||
Do not enter this field if you want to automatically generate a thumb
|
Do not enter this field if you want to automatically generate a thumb
|
||||||
*/
|
*/
|
||||||
mimetype: Mimetype.pdf, /* (for media messages) specify the type of media (optional for all media types except documents),
|
mimetype: Mimetype.pdf, /* (for media messages) specify the type of media (optional for all media types except documents),
|
||||||
import {Mimetype} from '@adiwajshing/baileys'
|
import {Mimetype} from '@adiwajshing/baileys-md'
|
||||||
*/
|
*/
|
||||||
filename: 'somefile.pdf', // (for media messages) file name for the media
|
filename: 'somefile.pdf', // (for media messages) file name for the media
|
||||||
/* will send audio messages as voice notes, if set to true */
|
/* will send audio messages as voice notes, if set to true */
|
||||||
@@ -391,7 +391,7 @@ The presence expires after about 10 seconds.
|
|||||||
|
|
||||||
If you want to save the media you received
|
If you want to save the media you received
|
||||||
``` ts
|
``` ts
|
||||||
import { MessageType } from '@adiwajshing/baileys'
|
import { MessageType } from '@adiwajshing/baileys-md'
|
||||||
conn.on ('message-new', async m => {
|
conn.on ('message-new', async m => {
|
||||||
if (!m.message) return // if there is no text or media message
|
if (!m.message) return // if there is no text or media message
|
||||||
const messageType = Object.keys (m.message)[0]// get what type of message it is -- text, image, video
|
const messageType = Object.keys (m.message)[0]// get what type of message it is -- text, image, video
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@adiwajshing/baileys",
|
"name": "@adiwajshing/baileys-md",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"description": "WhatsApp Multi-Device API",
|
"description": "WhatsApp Multi-Device API",
|
||||||
"homepage": "https://github.com/adiwajshing/Baileys",
|
"homepage": "https://github.com/adiwajshing/Baileys",
|
||||||
|
|||||||
Reference in New Issue
Block a user