diff --git a/src/WAConnection/Connect.ts b/src/WAConnection/Connect.ts index 895bfda..afdc3d3 100644 --- a/src/WAConnection/Connect.ts +++ b/src/WAConnection/Connect.ts @@ -113,8 +113,9 @@ export default class WAConnectionConnector extends WAConnectionValidator { const waitForChats = async () => { const json = await this.registerCallbackOneTime(['response', 'type:chat']) json[2].forEach(chat => { + chat[1].count = parseInt(chat[1].count) + chat[1].messages = [] chats.push(chat[1]) // chats data (log json to see what it looks like) - chats[chats.length-1].messages = [] // store the number of unread messages for each sender chatMap[chat[1].jid] = {index: chats.length-1, count: chat[1].count} //chat[1].count }) diff --git a/src/WAConnection/Constants.ts b/src/WAConnection/Constants.ts index ebd009c..b7682c4 100644 --- a/src/WAConnection/Constants.ts +++ b/src/WAConnection/Constants.ts @@ -55,7 +55,9 @@ export interface WAContact { } export interface WAChat { t: string - count: string + count: number + archive?: 'true' | 'false' + read_only?: 'true' | 'false' spam: 'false' | 'true' jid: string modify_tag: string