diff --git a/.gitignore b/.gitignore index be4a59c..11f028d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ package-lock.json */.DS_Store .DS_Store .env -lib auth_info_browser.json yarn.lock browser-messages.json diff --git a/src/WAClient/Tests.ts b/src/WAClient/Tests.ts index b75a7f7..ab8c776 100644 --- a/src/WAClient/Tests.ts +++ b/src/WAClient/Tests.ts @@ -264,4 +264,12 @@ WAClientTest('Events', (client) => { const response = await client.sendMessage(testJid, 'My Name Jeff', MessageType.text) await promiseTimeout(10000, waitForUpdate()) }) + /*it('should retreive all conversations', async () => { + const [chats] = await client.receiveChatsAndContacts (10000) + for (let chat of chats.all()) { + console.log ('receiving ' + chat.jid) + const convo = await client.loadConversation (chat.jid.replace('@s.whatsapp.net', '@c.us'), 25) + await createTimeout (200) + } + })*/ }) diff --git a/src/WAConnection/Base.ts b/src/WAConnection/Base.ts index c4e5cfe..ea40972 100644 --- a/src/WAConnection/Base.ts +++ b/src/WAConnection/Base.ts @@ -221,17 +221,11 @@ export default class WAConnectionBase { * @param [binaryTags] the tags to attach if the query is supposed to be sent encoded in binary * @param [timeoutMs] timeout after which the query will be failed (set to null to disable a timeout) * @param [tag] the tag to attach to the message - * recieved JSON */ - async queryExpecting200( - json: any[] | WANode, - binaryTags: WATag = null, - timeoutMs: number = null, - tag: string = null, - ) { + async queryExpecting200(json: any[] | WANode, binaryTags?: WATag, timeoutMs?: number, tag?: string) { const response = await this.query(json, binaryTags, timeoutMs, tag) if (response.status && Math.floor(+response.status / 100) !== 2) { - throw new BaileysError(`Unexpected status code: ${response.status}`, {query: json}) + throw new BaileysError(`Unexpected status code in '${json[0] || 'generic query'}': ${response.status}`, {query: json}) } return response } @@ -243,7 +237,7 @@ export default class WAConnectionBase { * @param tag the tag to attach to the message * recieved JSON */ - async query(json: any[] | WANode, binaryTags: WATag = null, timeoutMs: number = null, tag: string = null) { + async query(json: any[] | WANode, binaryTags?: WATag, timeoutMs?: number, tag?: string) { if (binaryTags) tag = await this.sendBinary(json as WANode, binaryTags, tag) else tag = await this.sendJSON(json, tag)