Made it better! Much better caching

This commit is contained in:
hydrabolt
2015-08-11 16:55:32 +01:00
parent 4edaba5a1f
commit 6887e0d6bc
6 changed files with 214 additions and 31 deletions

View File

@@ -1,12 +1,23 @@
var User = require("./user.js").User;
exports.Message = function(time, author, content, channel, id, mentions){
if(!content){
message = time;
channel = author;
time = message.timestamp;
author = message.author;
content = message.content;
id = message.id;
mentions = message.mentions;
}
this.time = Date.parse(time);
this.author = new User(author.username, author.id, author.discriminator, author.avatar);
this.author = new User(author);
this.content = content.replace(/<[^>]*>/g, "").replace(/\s+/g, ' ').trim();
this.channel = channel;
this.id = id;
this.mentions = [];
this.mentions = mentions || [];
for(x in mentions){
var _mention = mentions[x];
this.mentions.push( new User(_mention.username, _mention.id, _mention.discriminator, _mention.avatar) );