feat : send conversation seen (#66)

After this commit, chats will be automatically marked as seen when a message is sent to it. If this is not the intended behavior, `sendSeen: false` can be set as part of the options object. 

You can also manually mark a conversation as seen by calling the sendSeen() function on the Chat.

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
sahalMoidu
2020-03-02 00:12:35 +05:30
committed by GitHub
parent 48b9ae1e81
commit 98458f760e
4 changed files with 49 additions and 7 deletions

View File

@@ -11,7 +11,7 @@ class Chat extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
if (data) this._patch(data);
}
_patch(data) {
@@ -70,6 +70,14 @@ class Chat extends Base {
return this.client.sendMessage(this.id._serialized, content, options);
}
/**
* Set the message as seen
* @returns {Promise<Boolean>} result
*/
async sendSeen() {
return this.client.sendSeen(this.id._serialized);
}
/**
* Clears all messages from the chat
* @returns {Promise<Boolean>} result