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

@@ -54,7 +54,8 @@ client.on('message', async msg => {
let messageIndex = msg.body.indexOf(number) + number.length;
let message = msg.body.slice(messageIndex, msg.body.length);
number = number.includes('@c.us') ? number : `${number}@c.us`;
let chat = await msg.getChat();
chat.sendSeen();
client.sendMessage(number, message);
} else if (msg.body.startsWith('!subject ')) {
@@ -160,7 +161,7 @@ client.on('message', async msg => {
});
} else if (msg.body == '!delete' && msg.hasQuotedMsg) {
const quotedMsg = await msg.getQuotedMessage();
if(quotedMsg.fromMe) {
if (quotedMsg.fromMe) {
quotedMsg.delete(true);
} else {
msg.reply('I can only delete my own messages');