diff --git a/README.md b/README.md index a3f375a..f9bdd1e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/WAClient/Base.ts b/src/WAClient/Base.ts index ae8671c..33f4673 100644 --- a/src/WAClient/Base.ts +++ b/src/WAClient/Base.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 */ 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) diff --git a/src/WAClient/Constants.ts b/src/WAClient/Constants.ts index c58a023..8c1847a 100644 --- a/src/WAClient/Constants.ts +++ b/src/WAClient/Constants.ts @@ -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 diff --git a/src/WAClient/Messages.ts b/src/WAClient/Messages.ts index 0d50282..360569f 100644 --- a/src/WAClient/Messages.ts +++ b/src/WAClient/Messages.ts @@ -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} diff --git a/src/WAConnection/Constants.ts b/src/WAConnection/Constants.ts index 7e0c01d..153b8f2 100644 --- a/src/WAConnection/Constants.ts +++ b/src/WAConnection/Constants.ts @@ -87,3 +87,7 @@ export enum WAFlag { } /** Tag used with binary queries */ export type WATag = [WAMetric, WAFlag] +export * as WAMessageProto from '../../WAMessage/WAMessage' + + +