This commit is contained in:
Adhiraj Singh
2020-06-16 12:46:10 +05:30
2 changed files with 23 additions and 19 deletions

View File

@@ -7,12 +7,15 @@
Baileys has also been written from the ground up to be very extensible and simple to use. Baileys has also been written from the ground up to be very extensible and simple to use.
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).
If you're interested in building a WhatsApp bot, you may wanna check out [WhatsAppInfoBot](https://github.com/adiwajshing/WhatsappInfoBot) and an actual bot built with it, [Messcat](https://github.com/adiwajshing/Messcat).
## 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,7 +173,8 @@ 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:
The last parameter when sending messages is `info`, a JSON object, providing some information about the message. It can have the following __optional__ values:
``` javascript ``` javascript
info = { info = {
caption: "hello there!", // (for media messages) the caption to send with the media (cannot be sent with stickers though) caption: "hello there!", // (for media messages) the caption to send with the media (cannot be sent with stickers though)

View File

@@ -102,7 +102,7 @@ module.exports = {
const loadMessage = () => { const loadMessage = () => {
return this.loadConversation(jid, chunkSize, offsetID, mostRecentFirst) return this.loadConversation(jid, chunkSize, offsetID, mostRecentFirst)
.then (json => { .then (([json]) => {
if (json[2]) { if (json[2]) {
// callback with most recent message first (descending order of date) // callback with most recent message first (descending order of date)
let lastMessage let lastMessage