mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
feat(MessageMentions): fix typings/docs, add resolvables support (#4339)
This commit is contained in:
@@ -79,14 +79,14 @@ class MessageMentions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached members for {@link MessageMention#members}
|
* Cached members for {@link MessageMentions#members}
|
||||||
* @type {?Collection<Snowflake, GuildMember>}
|
* @type {?Collection<Snowflake, GuildMember>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._members = null;
|
this._members = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached channels for {@link MessageMention#channels}
|
* Cached channels for {@link MessageMentions#channels}
|
||||||
* @type {?Collection<Snowflake, GuildChannel>}
|
* @type {?Collection<Snowflake, GuildChannel>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -164,7 +164,7 @@ class MessageMentions {
|
|||||||
/**
|
/**
|
||||||
* Checks if a user, guild member, role, or channel is mentioned.
|
* Checks if a user, guild member, role, or channel is mentioned.
|
||||||
* Takes into account user mentions, role mentions, and @everyone/@here mentions.
|
* Takes into account user mentions, role mentions, and @everyone/@here mentions.
|
||||||
* @param {UserResolvable|GuildMember|Role|GuildChannel} data User/GuildMember/Role/Channel to check
|
* @param {UserResolvable|RoleResolvable|GuildChannelResolvable} data User/Role/Channel to check
|
||||||
* @param {Object} [options] Options
|
* @param {Object} [options] Options
|
||||||
* @param {boolean} [options.ignoreDirect=false] - Whether to ignore direct mentions to the item
|
* @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.ignoreRoles=false] - Whether to ignore role mentions to a guild member
|
||||||
@@ -179,7 +179,11 @@ class MessageMentions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreDirect) {
|
if (!ignoreDirect) {
|
||||||
const id = data.id || data;
|
const id =
|
||||||
|
this.client.users.resolveID(data) ||
|
||||||
|
(this.guild && this.guild.roles.resolveID(data)) ||
|
||||||
|
this.client.channels.resolveID(data);
|
||||||
|
|
||||||
return this.users.has(id) || this.channels.has(id) || this.roles.has(id);
|
return this.users.has(id) || this.channels.has(id) || this.roles.has(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
typings/index.d.ts
vendored
4
typings/index.d.ts
vendored
@@ -1072,7 +1072,7 @@ declare module 'discord.js' {
|
|||||||
everyone: boolean,
|
everyone: boolean,
|
||||||
);
|
);
|
||||||
private _channels: Collection<Snowflake, GuildChannel> | null;
|
private _channels: Collection<Snowflake, GuildChannel> | null;
|
||||||
private readonly _content: Message;
|
private readonly _content: string;
|
||||||
private _members: Collection<Snowflake, GuildMember> | null;
|
private _members: Collection<Snowflake, GuildMember> | null;
|
||||||
|
|
||||||
public readonly channels: Collection<Snowflake, TextChannel>;
|
public readonly channels: Collection<Snowflake, TextChannel>;
|
||||||
@@ -1080,7 +1080,7 @@ declare module 'discord.js' {
|
|||||||
public everyone: boolean;
|
public everyone: boolean;
|
||||||
public readonly guild: Guild;
|
public readonly guild: Guild;
|
||||||
public has(
|
public has(
|
||||||
data: User | GuildMember | Role | GuildChannel,
|
data: UserResolvable | RoleResolvable | GuildChannelResolvable,
|
||||||
options?: {
|
options?: {
|
||||||
ignoreDirect?: boolean;
|
ignoreDirect?: boolean;
|
||||||
ignoreRoles?: boolean;
|
ignoreRoles?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user