Added msg.isMentioned

This commit is contained in:
hydrabolt
2015-11-18 17:24:15 +00:00
parent c342ca4116
commit 6bca494ddc
4 changed files with 26 additions and 0 deletions

View File

@@ -37,6 +37,15 @@ var Message = (function () {
}); });
} }
Message.prototype.isMentioned = function isMentioned(user) {
user = this.client.internal.resolver.resolveUser(user);
if (user) {
return this.mentions.has(user);
} else {
return false;
}
};
Message.prototype.toString = function toString() { Message.prototype.toString = function toString() {
return this.content; return this.content;
}; };

View File

@@ -25,6 +25,10 @@ var Cache = (function (_Array) {
return found; return found;
}; };
Cache.prototype.has = function has(key, value) {
return !!this.get(key, value);
};
Cache.prototype.getAll = function getAll(key, value) { Cache.prototype.getAll = function getAll(key, value) {
var found = []; var found = [];
this.forEach(function (val, index, array) { this.forEach(function (val, index, array) {

View File

@@ -38,6 +38,15 @@ class Message{
}); });
} }
isMentioned(user){
user = this.client.internal.resolver.resolveUser(user);
if (user) {
return this.mentions.has(user);
} else {
return false;
}
}
toString(){ toString(){
return this.content; return this.content;
} }

View File

@@ -17,6 +17,10 @@ class Cache extends Array {
return found; return found;
} }
has(key, value) {
return !!this.get(key, value);
}
getAll(key, value) { getAll(key, value) {
var found = []; var found = [];
this.forEach((val, index, array) => { this.forEach((val, index, array) => {