Deleted examples, beginning to write in EC6.

Examples and Hydrabot will soon live in a separate repo which is better
suited to learning - this is so the main package isn't bloated.
This commit is contained in:
hydrabolt
2015-08-23 16:55:23 +01:00
parent 16b007c635
commit 35b61312b9
40 changed files with 1830 additions and 2486 deletions

View File

@@ -1,10 +1,12 @@
var User = require( "./user.js" ).User;
var List = require( "./list.js" ).List;
var PMChannel = require( "./PMChannel.js" ).PMChannel;
"use strict";
exports.Message = function( time, author, content, channel, id, mentions, everyoneMentioned, embeds ) {
var User = require("./user.js").User;
var List = require("./list.js").List;
var PMChannel = require("./PMChannel.js").PMChannel;
if ( !content ) {
exports.Message = function (time, author, content, channel, id, mentions, everyoneMentioned, embeds) {
if (!content) {
message = time;
channel = author;
time = message.timestamp;
@@ -16,24 +18,24 @@ exports.Message = function( time, author, content, channel, id, mentions, everyo
embeds = message.embeds;
}
this.time = Date.parse( time );
this.author = new User( author );
this.content = content.replace( /\s+/g, ' ' ).trim(); //content.replace(/<[^>]*>/g, "").replace(/\s+/g, ' ').trim();
this.time = Date.parse(time);
this.author = new User(author);
this.content = content.replace(/\s+/g, ' ').trim(); //content.replace(/<[^>]*>/g, "").replace(/\s+/g, ' ').trim();
this.channel = channel;
this.id = id;
this.mentions = new List( "id" );
this.mentions = new List("id");
this.everyoneMentioned = everyoneMentioned;
this.embeds = embeds;
for ( x in mentions ) {
var _mention = mentions[ x ];
this.mentions.add( new User( _mention ) );
for (x in mentions) {
var _mention = mentions[x];
this.mentions.add(new User(_mention));
}
}
};
exports.Message.prototype.isPM = function() {
return ( this.channel instanceof PMChannel );
}
exports.Message.prototype.isPM = function () {
return this.channel instanceof PMChannel;
};
exports.Message.prototype.isMentioned = function( user ) {
return ( this.mentions.filter( "id", user.id ).length > 0 );
}
exports.Message.prototype.isMentioned = function (user) {
return this.mentions.filter("id", user.id).length > 0;
};