diff --git a/src/structures/MessageMentions.js b/src/structures/MessageMentions.js index 1b49c5ea8..ee4a0e69d 100644 --- a/src/structures/MessageMentions.js +++ b/src/structures/MessageMentions.js @@ -117,19 +117,27 @@ class MessageMentions { } /** - * Check if a user is mentioned. + * Checks if a user, guild member, role, or channel is mentioned. * Takes into account user mentions, role mentions, and @everyone/@here mentions. * @param {UserResolvable|GuildMember|Role|GuildChannel} data User/GuildMember/Role/Channel to check - * @param {boolean} [strict=true] If role mentions and everyone/here mentions should be included + * @param {Object} [options] Options + * @param {boolean} [options.ignoreDirect=false] - Whether to ignore direct mentions to the item + * @param {boolean} [options.ignoreRoles=false] - Whether to ignore role mentions to a guild member + * @param {boolean} [options.ignoreEveryone=false] - Whether to ignore everyone/here mentions * @returns {boolean} */ - has(data, strict = true) { - if (strict && this.everyone) return true; - if (strict && data instanceof GuildMember) { + has(data, { ignoreDirect = false, ignoreRoles = false, ignoreEveryone = false } = {}) { + if (!ignoreEveryone && this.everyone) return true; + if (!ignoreRoles && data instanceof GuildMember) { for (const role of this.roles.values()) if (data.roles.has(role.id)) return true; } - const id = data.id || data; - return this.users.has(id) || this.channels.has(id) || this.roles.has(id); + + if (!ignoreDirect) { + const id = data.id || data; + return this.users.has(id) || this.channels.has(id) || this.roles.has(id); + } + + return false; } }