mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
fix message#isMemberMentioned (#1061)
* fix this * e * Update Message.js
This commit is contained in:
parent
e5e36d9111
commit
42527ea969
1 changed files with 4 additions and 4 deletions
|
|
@ -4,9 +4,7 @@ const MessageReaction = require('./MessageReaction');
|
|||
const Collection = require('../util/Collection');
|
||||
const Constants = require('../util/Constants');
|
||||
const escapeMarkdown = require('../util/EscapeMarkdown');
|
||||
|
||||
// Done purely for GuildMember, which would cause a bad circular dependency
|
||||
const Discord = require('..');
|
||||
let GuildMember;
|
||||
|
||||
/**
|
||||
* Represents a message on Discord
|
||||
|
|
@ -365,9 +363,11 @@ class Message {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
isMemberMentioned(member) {
|
||||
// Lazy-loading is used here to get around a circular dependency that breaks things
|
||||
if (!GuildMember) GuildMember = require('./GuildMember');
|
||||
if (this.mentions.everyone) return true;
|
||||
if (this.mentions.users.has(member.id)) return true;
|
||||
if (member instanceof Discord.GuildMember && member.roles.some(r => this.mentions.roles.has(r.id))) return true;
|
||||
if (member instanceof GuildMember && member.roles.some(r => this.mentions.roles.has(r.id))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue