Read receipt fix + export proto

This commit is contained in:
Adhiraj Singh
2020-07-09 15:22:25 +05:30
parent 7a2a5e03a8
commit 3a1e59ed17
5 changed files with 10 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
# Baileys 2.0 - Typescript/Javascript WhatsApp Web API
# Baileys - Typescript/Javascript WhatsApp Web API
Baileys does not require Selenium or any other browser to be interface with WhatsApp Web, it does so directly using a **WebSocket**. Not running Selenium or Chromimum saves you like **half a gig** of ram :/
@@ -19,7 +19,7 @@ To run the example script, download or clone the repo and then type the followin
## Install
Create and cd to your NPM project directory and then in terminal, write:
1. stable: `npm install @adiwajshing/baileys`
2. stabl-ish (but quicker fixes & latest features): `npm install github:adiwajshing/baileys`
2. stabl-ish w quicker fixes & latest features: `npm install github:adiwajshing/baileys`
Then import in your code using:
``` ts

View File

@@ -59,7 +59,7 @@ export default class WhatsAppWebBase extends WAConnection {
}
/** Set the callback for presence updates; if someone goes offline/online, this callback will be fired */
setOnPresenceUpdate(callback: (p: PresenceUpdate) => void) {
this.registerCallback('Presence', (json) => callback(json[1]))
this.registerCallback('Presence', json => callback(json[1]))
}
/** Query whether a given number is registered on WhatsApp */
isOnWhatsApp = (jid: string) => this.query(['query', 'exist', jid]).then((m) => m.status === 200)

View File

@@ -85,7 +85,8 @@ export interface MessageStatusUpdate {
}
export interface PresenceUpdate {
id: string
type?: string
participant?: string
type?: Presence
deny?: boolean
}
// path to upload the media

View File

@@ -29,7 +29,7 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
count: messageID ? '1' : null,
index: messageID,
owner: 'false',
type: type==='unread' && 'false'
type: type==='unread' ? 'false' : null
}
return this.setQuery ([['read', attributes, null]])
}
@@ -63,7 +63,6 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
chatAttrs.type = type
break
}
console.log (chatAttrs)
let response = await this.setQuery ([['chat', chatAttrs, null]]) as any
response.stamp = strStamp
return response as {status: number, stamp: string}

View File

@@ -87,3 +87,7 @@ export enum WAFlag {
}
/** Tag used with binary queries */
export type WATag = [WAMetric, WAFlag]
export * as WAMessageProto from '../../WAMessage/WAMessage'