mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 12:40:50 +00:00
fix: consider #nsfw false if not present in data (#4593)
This commit is contained in:
parent
276dddcbfb
commit
fab3153de6
2 changed files with 21 additions and 9 deletions
|
|
@ -7,15 +7,25 @@ const GuildChannel = require('./GuildChannel');
|
||||||
* @extends {GuildChannel}
|
* @extends {GuildChannel}
|
||||||
*/
|
*/
|
||||||
class StoreChannel extends GuildChannel {
|
class StoreChannel extends GuildChannel {
|
||||||
_patch(data) {
|
/**
|
||||||
super._patch(data);
|
* @param {*} guild The guild the store channel is part of
|
||||||
|
* @param {*} data The data for the store channel
|
||||||
|
*/
|
||||||
|
constructor(guild, data) {
|
||||||
|
super(guild, data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the guild considers this channel NSFW
|
* If the guild considers this channel NSFW
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
this.nsfw = data.nsfw;
|
this.nsfw = Boolean(data.nsfw);
|
||||||
|
}
|
||||||
|
|
||||||
|
_patch(data) {
|
||||||
|
super._patch(data);
|
||||||
|
|
||||||
|
if (typeof data.nsfw !== 'undefined') this.nsfw = Boolean(data.nsfw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,13 @@ class TextChannel extends GuildChannel {
|
||||||
* @type {MessageManager}
|
* @type {MessageManager}
|
||||||
*/
|
*/
|
||||||
this.messages = new MessageManager(this);
|
this.messages = new MessageManager(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the guild considers this channel NSFW
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
this.nsfw = Boolean(data.nsfw);
|
||||||
this._typing = new Map();
|
this._typing = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,12 +43,7 @@ class TextChannel extends GuildChannel {
|
||||||
*/
|
*/
|
||||||
this.topic = data.topic;
|
this.topic = data.topic;
|
||||||
|
|
||||||
/**
|
if (typeof data.nsfw !== 'undefined') this.nsfw = Boolean(data.nsfw);
|
||||||
* If the guild considers this channel NSFW
|
|
||||||
* @type {boolean}
|
|
||||||
* @readonly
|
|
||||||
*/
|
|
||||||
this.nsfw = data.nsfw;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ID of the last message sent in this channel, if one was sent
|
* The ID of the last message sent in this channel, if one was sent
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue