Bug Fixes + ConversationExtract

This commit is contained in:
Adhiraj
2020-05-01 22:13:46 +05:30
parent 304466425d
commit 266e695b3d
6 changed files with 134 additions and 27 deletions

View File

@@ -28,6 +28,9 @@ module.exports = function(WhatsAppWeb) {
}
// send a text message to someone, optionally you can provide a quoted message & the timestamp for the message
WhatsAppWeb.prototype.sendTextMessage = function (id, txt, quoted=null, timestamp=null) {
if (typeof txt !== "string") {
return Promise.reject("")
}
let message
if (quoted) {
message = {
@@ -149,9 +152,9 @@ module.exports = function(WhatsAppWeb) {
const json = [
"action",
{epoch: this.msgCount.toString(), type: "relay" },
[ ['message', null, messageJSON] ]
[ ["message", null, messageJSON] ]
]
return this.query(json, [16, 128])
return this.query(json, [16, 64])
}
// send query message to WhatsApp servers; returns a promise
WhatsAppWeb.prototype.query = function (json, binaryTags=null) {
@@ -169,7 +172,7 @@ module.exports = function(WhatsAppWeb) {
// send a binary message, the tags parameter tell WhatsApp what the message is all about
WhatsAppWeb.prototype.sendBinary = function (json, tags) {
const binary = this.encoder.write(json) // encode the JSON to the WhatsApp binary format
var buff = Utils.aesEncrypt(binary, this.authInfo.encKey) // encrypt it using AES and our encKey
const sign = Utils.hmacSign(buff, this.authInfo.macKey) // sign the message using HMAC and our macKey
const tag = Utils.generateMessageTag()