mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Unread fix + regen QR code changes + Browser message decoding
This commit is contained in:
@@ -20,16 +20,16 @@ import { proto } from '../../WAMessage/WAMessage'
|
||||
export default class WhatsAppWebMessages extends WhatsAppWebBase {
|
||||
/**
|
||||
* Send a read receipt to the given ID for a certain message
|
||||
* @param {string} jid the ID of the person/group whose message you want to mark read
|
||||
* @param {string} [messageID] optionally, the message ID
|
||||
* @param jid the ID of the person/group whose message you want to mark read
|
||||
* @param messageID optionally, the message ID
|
||||
* @param type whether to read or unread the message
|
||||
*/
|
||||
async sendReadReceipt(jid: string, messageID?: string, type: 'read' | 'unread' = 'read') {
|
||||
const attributes = {
|
||||
jid: jid,
|
||||
count: messageID ? '1' : null,
|
||||
count: type === 'read' ? '1' : '-2',
|
||||
index: messageID,
|
||||
owner: 'false',
|
||||
type: type==='unread' ? 'false' : null
|
||||
owner: messageID ? 'false' : null
|
||||
}
|
||||
return this.setQuery ([['read', attributes, null]])
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@ import * as fs from 'fs'
|
||||
import * as assert from 'assert'
|
||||
|
||||
import { decodeMediaMessage, validateJIDForSending } from './Utils'
|
||||
import { promiseTimeout } from '../WAConnection/Utils'
|
||||
import { promiseTimeout, createTimeout } from '../WAConnection/Utils'
|
||||
|
||||
require ('dotenv').config () // dotenv to load test jid
|
||||
const testJid = process.env.TEST_JID || '1234@s.whatsapp.net' // set TEST_JID=xyz@s.whatsapp.net in a .env file in the root directory
|
||||
|
||||
const createTimeout = (timeout) => new Promise(resolve => setTimeout(resolve, timeout))
|
||||
|
||||
async function sendAndRetreiveMessage(client: WAClient, content, type: MessageType, options: MessageOptions = {}) {
|
||||
const response = await client.sendMessage(testJid, content, type, options)
|
||||
assert.strictEqual(response.status, 200)
|
||||
|
||||
Reference in New Issue
Block a user