mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 08:41:29 +00:00
Add Message - webhookID, isMemberMentioned (#946)
* Add Message - webhookID, isMemberMentioned * Update Message.js * Update Message.js * Update Message.js * Update Message.js
This commit is contained in:
parent
6cfbf76406
commit
676a895da7
1 changed files with 21 additions and 1 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
const Attachment = require('./MessageAttachment');
|
const Attachment = require('./MessageAttachment');
|
||||||
const Embed = require('./MessageEmbed');
|
const Embed = require('./MessageEmbed');
|
||||||
|
const MessageReaction = require('./MessageReaction');
|
||||||
|
const GuildMember = require('./GuildMember');
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
const Constants = require('../util/Constants');
|
const Constants = require('../util/Constants');
|
||||||
const escapeMarkdown = require('../util/EscapeMarkdown');
|
const escapeMarkdown = require('../util/EscapeMarkdown');
|
||||||
const MessageReaction = require('./MessageReaction');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a message on Discord
|
* Represents a message on Discord
|
||||||
|
|
@ -163,6 +164,12 @@ class Message {
|
||||||
this.reactions.set(id, new MessageReaction(this, reaction.emoji, reaction.count, reaction.me));
|
this.reactions.set(id, new MessageReaction(this, reaction.emoji, reaction.count, reaction.me));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ID of the webhook that sent the message, if applicable
|
||||||
|
* @type {?string}
|
||||||
|
*/
|
||||||
|
this.webhookID = data.webhook_id || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
patch(data) { // eslint-disable-line complexity
|
patch(data) { // eslint-disable-line complexity
|
||||||
|
|
@ -343,6 +350,19 @@ class Message {
|
||||||
return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data);
|
return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not a guild member is mentioned in this message. Takes into account
|
||||||
|
* user mentions, role mentions, and @everyone/@here mentions.
|
||||||
|
* @param {GuildMember|User} member Member/user to check for a mention of
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isMemberMentioned(member) {
|
||||||
|
if (this.mentions.everyone) return true;
|
||||||
|
if (this.mentions.users.has(member.id)) return true;
|
||||||
|
if (member instanceof GuildMember && member.roles.some(r => this.mentions.roles.has(r.id))) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options that can be passed into editMessage
|
* Options that can be passed into editMessage
|
||||||
* @typedef {Object} MessageEditOptions
|
* @typedef {Object} MessageEditOptions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue