mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
minor fixes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,7 +5,6 @@ package-lock.json
|
||||
*/.DS_Store
|
||||
.DS_Store
|
||||
.env
|
||||
lib
|
||||
auth_info_browser.json
|
||||
yarn.lock
|
||||
browser-messages.json
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
})*/
|
||||
})
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user