Basic Chat and Message model implementation
This commit is contained in:
parent
1dab219764
commit
6442469437
1 changed files with 118 additions and 18 deletions
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue