mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
typo fix in 'loadConversation'
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
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 github:adiwajshing/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')
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ module.exports = {
|
|||||||
* @param {boolean} [mostRecentFirst] retreive the most recent message first or retreive from the converation start
|
* @param {boolean} [mostRecentFirst] retreive the most recent message first or retreive from the converation start
|
||||||
* @return {Promise} Promise of the messages loaded
|
* @return {Promise} Promise of the messages loaded
|
||||||
*/
|
*/
|
||||||
loadConveration: function (jid, count, indexMessage=null, mostRecentFirst=true) {
|
loadConversation: function (jid, count, indexMessage=null, mostRecentFirst=true) {
|
||||||
// construct JSON
|
// construct JSON
|
||||||
let json = [
|
let json = [
|
||||||
"query",
|
"query",
|
||||||
@@ -101,7 +101,7 @@ module.exports = {
|
|||||||
var offsetID = null
|
var offsetID = null
|
||||||
|
|
||||||
const loadMessage = () => {
|
const loadMessage = () => {
|
||||||
return this.getMessages(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)
|
||||||
@@ -120,10 +120,10 @@ module.exports = {
|
|||||||
// if there are still more messages
|
// if there are still more messages
|
||||||
if (json[2].length >= chunkSize) {
|
if (json[2].length >= chunkSize) {
|
||||||
offsetID = lastMessage.key // get the last message
|
offsetID = lastMessage.key // get the last message
|
||||||
return new Promise ( (resolve, reject) => {
|
return new Promise ((resolve, reject) => {
|
||||||
// send query after 200 ms
|
// send query after 200 ms
|
||||||
setTimeout( () => loadMessage().then (resolve).catch(reject), 200)
|
setTimeout( () => loadMessage().then (resolve).catch(reject), 200)
|
||||||
} )
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ WhatsAppWeb.prototype.getChats = query.getChats
|
|||||||
/** Query whether your phone is still connected to this WhatsApp Web */
|
/** Query whether your phone is still connected to this WhatsApp Web */
|
||||||
WhatsAppWeb.prototype.isPhoneConnected = query.isPhoneConnected
|
WhatsAppWeb.prototype.isPhoneConnected = query.isPhoneConnected
|
||||||
/** Load the conversation with a group or person */
|
/** Load the conversation with a group or person */
|
||||||
WhatsAppWeb.prototype.loadConveration = query.loadConveration
|
WhatsAppWeb.prototype.loadConversation = query.loadConversation
|
||||||
/** Load the entire friggin conversation with a group or person */
|
/** Load the entire friggin conversation with a group or person */
|
||||||
WhatsAppWeb.prototype.loadEntireConversation = query.loadEntireConversation
|
WhatsAppWeb.prototype.loadEntireConversation = query.loadEntireConversation
|
||||||
/** Create a group */
|
/** Create a group */
|
||||||
|
|||||||
Reference in New Issue
Block a user