mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
Allow MessageMentions#channels to function in DMs
This commit is contained in:
parent
aa35e21b84
commit
e2c8ba5be0
1 changed files with 9 additions and 3 deletions
|
|
@ -55,6 +55,13 @@ class MessageMentions {
|
|||
*/
|
||||
this._content = message.content;
|
||||
|
||||
/**
|
||||
* Client the message is from
|
||||
* @type {Client}
|
||||
* @private
|
||||
*/
|
||||
this._client = message.client;
|
||||
|
||||
/**
|
||||
* Guild the message is in
|
||||
* @type {?Guild}
|
||||
|
|
@ -94,17 +101,16 @@ class MessageMentions {
|
|||
}
|
||||
|
||||
/**
|
||||
* Any channels that were mentioned (only in {@link TextChannel}s)
|
||||
* Any channels that were mentioned
|
||||
* @type {?Collection<Snowflake, GuildChannel>}
|
||||
* @readonly
|
||||
*/
|
||||
get channels() {
|
||||
if (this._channels) return this._channels;
|
||||
if (!this._guild) return null;
|
||||
this._channels = new Collection();
|
||||
let matches;
|
||||
while ((matches = this.constructor.CHANNELS_PATTERN.exec(this._content)) !== null) {
|
||||
const chan = this._guild.channels.get(matches[1]);
|
||||
const chan = this._client.channels.get(matches[1]);
|
||||
if (chan) this._channels.set(chan.id, chan);
|
||||
}
|
||||
return this._channels;
|
||||
|
|
|
|||
Loading…
Reference in a new issue