mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 12:39:20 +00:00
Ignore old messages
This commit is contained in:
@@ -49,7 +49,7 @@ class Client extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await page.exposeFunction('onAddMessageEvent', msg => {
|
await page.exposeFunction('onAddMessageEvent', msg => {
|
||||||
if (msg.id.fromMe) return;
|
if (msg.id.fromMe || !msg.isNewMsg) return;
|
||||||
this.emit(Events.MESSAGE_CREATE, new Message(this, msg));
|
this.emit(Events.MESSAGE_CREATE, new Message(this, msg));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,12 @@ class Message extends Base {
|
|||||||
static get WAppModel() {
|
static get WAppModel() {
|
||||||
return 'Msg';
|
return 'Msg';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get extraFields() {
|
||||||
|
return [
|
||||||
|
'isNewMsg'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Message;
|
module.exports = Message;
|
||||||
Reference in New Issue
Block a user