mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 20:49:14 +00:00
feat: send typing in chat (#87)
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
committed by
GitHub
parent
72441beb37
commit
d35f101fac
@@ -168,6 +168,9 @@ client.on('message', async msg => {
|
|||||||
} else if (msg.body === '!archive') {
|
} else if (msg.body === '!archive') {
|
||||||
const chat = await msg.getChat();
|
const chat = await msg.getChat();
|
||||||
chat.archive();
|
chat.archive();
|
||||||
|
} else if (msg.body === '!typing') {
|
||||||
|
const chat = await msg.getChat();
|
||||||
|
chat.typing();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,16 @@ class Chat extends Base {
|
|||||||
return this.client.unarchiveChat(this.id._serialized);
|
return this.client.unarchiveChat(this.id._serialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start typing in chat. This will last for 25 seconds.
|
||||||
|
*/
|
||||||
|
async sendTyping() {
|
||||||
|
return this.client.pupPage.evaluate(chatId => {
|
||||||
|
window.WWebJS.typing(chatId);
|
||||||
|
return true;
|
||||||
|
}, this.id._serialized);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Chat;
|
module.exports = Chat;
|
||||||
@@ -255,6 +255,12 @@ exports.LoadUtils = () => {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.WWebJS.typing = async (chatId) => {
|
||||||
|
await window.Store.Wap.sendChatstateComposing(chatId);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.MarkAllRead = () => {
|
exports.MarkAllRead = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user