ensl_gathers/lib/chat/message.js

22 lines
385 B
JavaScript
Raw Normal View History

2015-07-21 14:10:24 +00:00
"use strict";
2015-07-22 13:53:50 +00:00
var Author = require("./author");
2015-07-21 14:10:24 +00:00
function Message (o) {
this.author = Author(o.author);
this.content = o.content;
this.createdAt = new Date();
};
Message.prototype.toJson = function () {
return {
author: {
username: this.author.username,
avatar: this.author.avatar
},
content: this.content,
createdAt: this.createdAt
}
};
module.exports = Message;