Finished most of structure

This commit is contained in:
hydrabolt
2015-10-31 21:56:13 +00:00
parent c5e5ab54db
commit 5ccaca915b
23 changed files with 323 additions and 70 deletions

35
src/Structures/Message.js Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
var Cache = require("../Util/Cache.js");
var User = require("./User.js");
class Message{
constructor(data, channel, client){
this.channel = channel;
this.client = client;
this.nonce = data.nonce;
this.attachments = data.attachments;
this.tts = data.tts;
this.embeds = data.embeds;
this.timestamp = Date.parse(data.timestamp);
this.everyoneMentioned = data.mention_everyone;
this.id = data.id;
if(data.edited_timestamp)
this.editedTimestamp = Date.parse(data.edited_timestamp);
this.author = client.internal.users.add(new User(data.author, client));
this.content = data.content;
this.mentions = new Cache();
data.mentions.forEach((mention) => {
// this is .add and not .get because it allows the bot to cache
// users from messages from logs who may have left the server and were
// not previously cached.
console.log(mention);
this.mentions.add(client.internal.users.add(new User(mention, client)));
});
}
}
module.exports = Message;