mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
Add Message.isMentioned
This commit is contained in:
@@ -284,6 +284,17 @@ class Message {
|
||||
return this.client.rest.methods.sendMessage(this.channel, newContent, options.tts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not a user, channel or role is mentioned in this message.
|
||||
* @param {GuildChannel|User|Role|string} data either a guild channel, user or a role object, or a string representing
|
||||
* the ID of any of these.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMentioned(data) {
|
||||
data = data.id ? data.id : data;
|
||||
return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pins this message to the channel's pinned messages
|
||||
* @returns {Promise<Message>}
|
||||
|
||||
Reference in New Issue
Block a user