feat: archive chats (#63)

This commit is contained in:
Aliyss Snow 2020-02-26 01:06:46 +01:00 • committed by GitHub
commit 132424ea08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,6 +50,12 @@ class Chat extends Base {
*/
this.timestamp = data.t;
/**
* Indicates if the Chat is archived
* @type {boolean}
*/
this.archived = data.archive;
return super._patch(data);
}
@ -62,6 +68,21 @@ class Chat extends Base {
async sendMessage(content, options) {
return this.client.sendMessage(this.id._serialized, content, options);
}
/**
* archives this chat
*/
async archive() {
return this.client.archiveChat(this.id._serialized);
}
/**
* un-archives this chat
*/
async unarchive() {
return this.client.unarchiveChat(this.id._serialized);
}
}
module.exports = Chat;