Add Message.isMentioned

This commit is contained in:
Amish Shah
2016-09-04 17:21:45 +01:00
parent 9f0db9d0d8
commit bf3c283998
2 changed files with 12 additions and 1 deletions

View File

@@ -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>}