Update README.md

This commit is contained in:
Adhiraj
2020-06-13 13:05:28 +05:30
parent b023546210
commit 7c793c4184

View File

@@ -8,11 +8,12 @@
If you require more functionality than provided, it'll super easy for you to write an extension (More on this at the end). If you require more functionality than provided, it'll super easy for you to write an extension (More on this at the end).
## Install ## Install
Create and cd to your NPM project directory and then in terminal, write: ``` npm install baileys ``` Create and cd to your NPM project directory and then in terminal, write: ``` npm install baileys ```
Then import in your code using: Then import in your code using:
``` javascript ``` javascript
const WhatsAppWeb = require('baileys') const WhatsAppWeb = require('baileys')
``` ```
## Connecting ## Connecting
``` javascript ``` javascript
const client = new WhatsAppWeb() const client = new WhatsAppWeb()
@@ -170,24 +171,25 @@ It's super simple
] ]
``` ```
- Tested formats: png, jpeg, webp (sticker), mp4, ogg - Tested formats: png, jpeg, webp (sticker), mp4, ogg
`options` is a JSON object, providing some information about the message. It can have the following __optional__ values:
``` javascript The last parameter when sending messages is `info`, a JSON object, providing some information about the message. It can have the following __optional__ values:
info = { ``` javascript
caption: "hello there!", // (for media messages) the caption to send with the media (cannot be sent with stickers though) info = {
thumbnail: "23GD#4/==", /* (for location & media messages) has to be a base 64 encoded JPEG if you want to send a custom thumb, caption: "hello there!", // (for media messages) the caption to send with the media (cannot be sent with stickers though)
or set to null if you don't want to send a thumbnail. thumbnail: "23GD#4/==", /* (for location & media messages) has to be a base 64 encoded JPEG if you want to send a custom thumb,
Do not enter this field if you want to automatically generate a thumb or set to null if you don't want to send a thumbnail.
Do not enter this field if you want to automatically generate a thumb
*/
mimetype: "application/pdf", /* (for media messages) specify the type of media (optional for all media types except documents),
for pdf files => set to "application/pdf",
for txt files => set to "application/txt"
etc.
*/ */
mimetype: "application/pdf", /* (for media messages) specify the type of media (optional for all media types except documents), gif: true, // (for video messages) if the video should be treated as a GIF
for pdf files => set to "application/pdf", quoted: quotedMessage, // the message you want to quote (can be used with sending all kinds of messages)
for txt files => set to "application/txt" timestamp: Date() // optional, if you want to manually set the timestamp of the message
etc. }
*/ ```
gif: true, // (for video messages) if the video should be treated as a GIF
quoted: quotedMessage, // the message you want to quote (can be used with sending all kinds of messages)
timestamp: Date() // optional, if you want to manually set the timestamp of the message
}
```
``` id ``` is the WhatsApp id of the person or group you're sending the message to. ``` id ``` is the WhatsApp id of the person or group you're sending the message to.