WAChat update

This commit is contained in:
Adhiraj Singh
2021-04-29 23:17:09 +05:30
parent 1d31b7a20c
commit 66fb931fa3
3 changed files with 5 additions and 12 deletions

View File

@@ -446,15 +446,14 @@ export class WAConnection extends Base {
}
}
/** inserts an empty chat into the DB */
protected chatAdd (jid: string, name?: string) {
protected chatAdd (jid: string, name?: string, properties: Partial<WAChat> = {}) {
const chat: WAChat = {
jid,
name,
t: unixTimestampSeconds(),
messages: newMessagesDB(),
count: 0,
modify_tag: '',
spam: 'false'
...(properties || {})
}
if(this.chats.insertIfAbsent(chat).length) {
this.emit('chat-new', chat)