Basic Chat and Message model implementation

This commit is contained in:
Pedro Lopez 2019-02-17 21:14:31 -04:00
commit 6442469437

View file

@ -2,8 +2,6 @@
const Base = require('./Base');
// TODO
/**
* Represents a Message on WhatsApp
* @extends {Base}
@ -12,7 +10,27 @@ class Message extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
}
_patch(data) {
this.id = data.id;
this.body = data.body;
this.type = data.type;
this.timestame = data.t;
this.from = data.from;
this.to = data.to;
this.author = data.author;
this.isForwarded = data.isForwarded;
this.broadcast = data.broadcast;
}
getChat() {
return this.client.getChatById(this.from);
}
static get WAppModel() {
return 'Msg';
}
}