mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 12:40:50 +00:00
Make MessageMentions#channels return an empty collection in DMs (#1430)
* Make MessageMentions#channels return an empty collection in DMs * reduce code duplication and corrected docstring
This commit is contained in:
parent
d6b7d31047
commit
88aa947376
1 changed files with 3 additions and 3 deletions
|
|
@ -94,14 +94,14 @@ class MessageMentions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any channels that were mentioned (only in {@link TextChannel}s)
|
* Any channels that were mentioned (only populated in {@link TextChannel}s)
|
||||||
* @type {?Collection<Snowflake, GuildChannel>}
|
* @type {Collection<Snowflake, GuildChannel>}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get channels() {
|
get channels() {
|
||||||
if (this._channels) return this._channels;
|
if (this._channels) return this._channels;
|
||||||
if (!this._guild) return null;
|
|
||||||
this._channels = new Collection();
|
this._channels = new Collection();
|
||||||
|
if (!this._guild) return this._channels;
|
||||||
let matches;
|
let matches;
|
||||||
while ((matches = this.constructor.CHANNELS_PATTERN.exec(this._content)) !== null) {
|
while ((matches = this.constructor.CHANNELS_PATTERN.exec(this._content)) !== null) {
|
||||||
const chan = this._guild.channels.get(matches[1]);
|
const chan = this._guild.channels.get(matches[1]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue