mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
Added msg.isMentioned
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ class Message{
|
|||||||
this.mentions.add(client.internal.users.add(new User(mention, client)));
|
this.mentions.add(client.internal.users.add(new User(mention, client)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|||||||
@@ -16,6 +16,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 = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user