typo fix in 'loadConversation'

This commit is contained in:
Adhiraj
2020-05-15 15:33:46 +05:30
parent b60bd03d21
commit 80adc095a3
4 changed files with 6 additions and 6 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -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).
* __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:
``` javascript
const WhatsAppWeb = require('Baileys')

View File

@@ -69,7 +69,7 @@ module.exports = {
* @param {boolean} [mostRecentFirst] retreive the most recent message first or retreive from the converation start
* @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
let json = [
"query",
@@ -101,7 +101,7 @@ module.exports = {
var offsetID = null
const loadMessage = () => {
return this.getMessages(jid, chunkSize, offsetID, mostRecentFirst)
return this.loadConversation(jid, chunkSize, offsetID, mostRecentFirst)
.then (json => {
if (json[2]) {
// callback with most recent message first (descending order of date)
@@ -120,10 +120,10 @@ module.exports = {
// if there are still more messages
if (json[2].length >= chunkSize) {
offsetID = lastMessage.key // get the last message
return new Promise ( (resolve, reject) => {
return new Promise ((resolve, reject) => {
// send query after 200 ms
setTimeout( () => loadMessage().then (resolve).catch(reject), 200)
} )
})
}
}
})

View File

@@ -237,7 +237,7 @@ WhatsAppWeb.prototype.getChats = query.getChats
/** Query whether your phone is still connected to this WhatsApp Web */
WhatsAppWeb.prototype.isPhoneConnected = query.isPhoneConnected
/** 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 */
WhatsAppWeb.prototype.loadEntireConversation = query.loadEntireConversation
/** Create a group */