mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
Add Message.isMentioned
This commit is contained in:
parent
9f0db9d0d8
commit
bf3c283998
2 changed files with 12 additions and 1 deletions
File diff suppressed because one or more lines are too long
|
|
@ -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>}
|
||||
|
|
|
|||
Loading…
Reference in a new issue