mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Read receipt fix + export proto
This commit is contained in:
@@ -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 :/
|
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
|
## Install
|
||||||
Create and cd to your NPM project directory and then in terminal, write:
|
Create and cd to your NPM project directory and then in terminal, write:
|
||||||
1. stable: `npm install @adiwajshing/baileys`
|
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:
|
Then import in your code using:
|
||||||
``` ts
|
``` ts
|
||||||
|
|||||||
@@ -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 */
|
/** Set the callback for presence updates; if someone goes offline/online, this callback will be fired */
|
||||||
setOnPresenceUpdate(callback: (p: PresenceUpdate) => void) {
|
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 */
|
/** Query whether a given number is registered on WhatsApp */
|
||||||
isOnWhatsApp = (jid: string) => this.query(['query', 'exist', jid]).then((m) => m.status === 200)
|
isOnWhatsApp = (jid: string) => this.query(['query', 'exist', jid]).then((m) => m.status === 200)
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ export interface MessageStatusUpdate {
|
|||||||
}
|
}
|
||||||
export interface PresenceUpdate {
|
export interface PresenceUpdate {
|
||||||
id: string
|
id: string
|
||||||
type?: string
|
participant?: string
|
||||||
|
type?: Presence
|
||||||
deny?: boolean
|
deny?: boolean
|
||||||
}
|
}
|
||||||
// path to upload the media
|
// path to upload the media
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
|
|||||||
count: messageID ? '1' : null,
|
count: messageID ? '1' : null,
|
||||||
index: messageID,
|
index: messageID,
|
||||||
owner: 'false',
|
owner: 'false',
|
||||||
type: type==='unread' && 'false'
|
type: type==='unread' ? 'false' : null
|
||||||
}
|
}
|
||||||
return this.setQuery ([['read', attributes, null]])
|
return this.setQuery ([['read', attributes, null]])
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,6 @@ export default class WhatsAppWebMessages extends WhatsAppWebBase {
|
|||||||
chatAttrs.type = type
|
chatAttrs.type = type
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
console.log (chatAttrs)
|
|
||||||
let response = await this.setQuery ([['chat', chatAttrs, null]]) as any
|
let response = await this.setQuery ([['chat', chatAttrs, null]]) as any
|
||||||
response.stamp = strStamp
|
response.stamp = strStamp
|
||||||
return response as {status: number, stamp: string}
|
return response as {status: number, stamp: string}
|
||||||
|
|||||||
@@ -87,3 +87,7 @@ export enum WAFlag {
|
|||||||
}
|
}
|
||||||
/** Tag used with binary queries */
|
/** Tag used with binary queries */
|
||||||
export type WATag = [WAMetric, WAFlag]
|
export type WATag = [WAMetric, WAFlag]
|
||||||
|
export * as WAMessageProto from '../../WAMessage/WAMessage'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user