mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
slimmed down package, fixed issues
This commit is contained in:
@@ -45,15 +45,9 @@
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^14.0.14",
|
||||
"@types/ws": "^7.2.6",
|
||||
"@typescript-eslint/eslint-plugin": "^3.5.0",
|
||||
"@typescript-eslint/parser": "^3.5.0",
|
||||
"assert": "^2.0.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"eslint": "^7.3.1",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"mocha": "^8.0.1",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-node-dev": "^1.0.0-pre.49",
|
||||
"typedoc": "^0.18.0",
|
||||
"typescript": "^3.9.5"
|
||||
|
||||
@@ -109,11 +109,16 @@ export default class WAConnectionConnector extends WAConnectionValidator {
|
||||
if (json[1].duplicate) json = await this.registerCallbackOneTime (['response', 'type:chat'])
|
||||
|
||||
if (!json[2]) return
|
||||
json[2].forEach(([_, chat]: [any, WAChat]) => {
|
||||
json[2].forEach(([item, chat]: [any, WAChat]) => {
|
||||
if (!chat) {
|
||||
this.log (`unexpectedly got null chat: ${item}, ${chat}`, MessageLogLevel.info)
|
||||
return
|
||||
}
|
||||
chat.count = +chat.count
|
||||
chat.messages = []
|
||||
chats.insert (chat) // chats data (log json to see what it looks like)
|
||||
})
|
||||
.filter (Boolean)
|
||||
|
||||
if (chats.all().length > 0) return waitForConvos()
|
||||
}
|
||||
|
||||
@@ -104,8 +104,6 @@ export default class WAConnectionValidator extends WAConnectionBase {
|
||||
return this.userMetaData
|
||||
}
|
||||
|
||||
if (json.connected) {
|
||||
// only if we're connected
|
||||
if (!json.secret) {
|
||||
// if we didn't get a secret, we don't need it, we're validated
|
||||
return onValidationSuccess()
|
||||
@@ -147,10 +145,6 @@ export default class WAConnectionValidator extends WAConnectionBase {
|
||||
// if the checksums didn't match
|
||||
throw new BaileysError ('HMAC validation failed', json)
|
||||
}
|
||||
} else {
|
||||
// if we didn't get the connected field (usually we get this message when one opens WhatsApp on their phone)
|
||||
throw new BaileysError (`invalid JSON`, json)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* When logging back in (restoring a previously closed session), WhatsApp may challenge one to check if one still has the encryption keys
|
||||
|
||||
Reference in New Issue
Block a user