mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user