mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Fixed isMentioned
This commit is contained in:
@@ -57,17 +57,13 @@ var Message = (function (_Equality) {
|
|||||||
// this is .add and not .get because it allows the bot to cache
|
// 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
|
// users from messages from logs who may have left the server and were
|
||||||
// not previously cached.
|
// not previously cached.
|
||||||
if (mention instanceof _User2["default"]) _this.mentions.push(mention);else _this.mentions.add(client.internal.users.add(new _User2["default"](mention, client)));
|
if (mention instanceof _User2["default"]) _this.mentions.add(mention);else _this.mentions.add(client.internal.users.add(new _User2["default"](mention, client)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Message.prototype.isMentioned = function isMentioned(user) {
|
Message.prototype.isMentioned = function isMentioned(user) {
|
||||||
user = this.client.internal.resolver.resolveUser(user);
|
user = this.client.internal.resolver.resolveUser(user);
|
||||||
if (user) {
|
return !!(user && this.mentions.has(user));
|
||||||
return this.mentions.has(user);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Message.prototype.toString = function toString() {
|
Message.prototype.toString = function toString() {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default class Message extends Equality{
|
|||||||
// users from messages from logs who may have left the server and were
|
// users from messages from logs who may have left the server and were
|
||||||
// not previously cached.
|
// not previously cached.
|
||||||
if(mention instanceof User)
|
if(mention instanceof User)
|
||||||
this.mentions.push(mention);
|
this.mentions.add(mention);
|
||||||
else
|
else
|
||||||
this.mentions.add(client.internal.users.add(new User(mention, client)));
|
this.mentions.add(client.internal.users.add(new User(mention, client)));
|
||||||
});
|
});
|
||||||
@@ -49,11 +49,7 @@ export default class Message extends Equality{
|
|||||||
|
|
||||||
isMentioned(user){
|
isMentioned(user){
|
||||||
user = this.client.internal.resolver.resolveUser(user);
|
user = this.client.internal.resolver.resolveUser(user);
|
||||||
if (user) {
|
return !!(user && this.mentions.has(user));
|
||||||
return this.mentions.has(user);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(){
|
toString(){
|
||||||
|
|||||||
Reference in New Issue
Block a user