Updated bot and added some more helpful features, such as isPM to messages to discover whether a message is from a PM

This commit is contained in:
hydrabolt
2015-08-14 17:43:51 +01:00
parent 8a41ffe356
commit d5e4e7ba8b
4 changed files with 188 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
var User = require( "./user.js" ).User;
var List = require( "./list.js" ).List;
var PMChannel = require( "./PMChannel.js" ).PMChannel;
exports.Message = function( time, author, content, channel, id, mentions, everyoneMentioned ) {
@@ -27,6 +28,10 @@ exports.Message = function( time, author, content, channel, id, mentions, everyo
}
}
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 );
}